The foreclosure process starts when the property owner misses certain numbers of payments and they are not able to catch up or modifiy the loan. There are 3 status: Pre-foreclosure, Auction (Sheriff's Sale), and Bank Owned.
If you buy at pre-foreclosure status, you can consider paying what is owed to the bank, a little more to help the seller, or negotiate a short-sale with the lender(s) if the property owes more than what it is worth. You can contact the seller directly or work with a realtor to see the inside of the house.
If you buy at the auction, then you will buy the property unseen. Even though you might have an opportunity to see the property prior to the auction, the condition might be changed.
If you buy foreclosure home after auction, (the lein holder owns it now), then you will either contact the owner or a realtor to see it.
In any case if you decide to make a purchase, your mortgage lender will ask your title company to review the property title so that you are buying without other liens and your lender can be the first on this property. You should also purchase title insurance to prevent any previous owner or lien holders claimming the property.
Hope this helps.