Only if the Seller is willing to sign a contract with "you" can you have an opportunity to try to buy the property at a bargain price "before it is foreclosed upon". Nowadays the Sellers are able to get principal reductions and some will also opt to stay in the house and do a Deed for Lease and rent at below market rates. Some Sellers may try a Short Sale and it could take 2 years before the Short Sale will eventually sell.
After foreclosure then the property is normally listed by a Realtor for all to bid on.
All the best,