The process of purchasing property in foreclosure is essentially the same as any purchase except, depending upon what stage of "foreclosure" the property is in, you as the buyer must be exceptionally flexible in your expectations. The fact is, properties that are in distress will be sold subject to the lender/s approval of the sale and in most cases, the property will be sold without repairs or other material considerations for the buyer. In some cases, such as an auction, the buyer may actually buy him or herself a new bunch of problems such as undisclosed liens on the property or material problems with the property that may push the limits of what's commonly referred to as "deferred maintenance".
That said, not all "distressed" properties are in bad shape and a qualified, prepared and patient buyer with a savvy agent who is experienced in these matters can successfully and happily purchase a "distressed" home. There is often more than one issue with various "foreclosure" properties, but here are the main ideas in different scenarios:
Short-Sale: house needs be sold for less than the seller owes. Seller's lender needs to agree to accept reduced payment on the loan.
REO: bank owns the property, they've already lost money on it and they're not likely to put anything more into it
Auction: You need cash to buy and to rehab if you want to stay there or flip it. As mentioned, this is a game for sophisticated investors.
I agree with the other comments about not limiting yourself to "foreclosures" in your search, but do find an agent to work for you in you purchase. Look for a full-time agent with experience and up-to-the-minute knowledge of distressed property sales, state and federal rules, and programs and incentives that can benefit you.