On any home, not just a foreclosure, you have to do a building inspection to find out what repairs are needed. When it is a regular home sale, you have (hopefully) a sellers disclosure that the seller has (hopefully) truthfully filled out telling you what they know about the home, but often during the building inspection the inspector will find things that the home owner doesn't know about the home. What happens is that something goes wrong so gradually that the homeowner doesn't really realize that it is going wrong - they just gradually cope with the changes until they forget that it wasn't ever like that, or it's something that is behind walls or just ready to go wrong (like a sewer line that is about rusted out but hasn't really started leaking yet, or a bathroom that is never used that has issues.
When it is a foreclosure, the family is long gone and the bank and the processors who are handling the deal have no clue. There might be somethings that are visable to the eye when they walk through the building, but normally they are several states away and processing paperwork and never see the home. To find out what is wrong, you have to VISIT the home and look at it, then if you don't see something that is wrong, and you want to buy it, then you pay to have it inspected (some banks will allow you to have an inspection and walk away and some won't - it is strictly an "as is" sale). Note that if the municipality requires an inspection in order to get an occupancy permit, you can buy the home, but before you can move in, if you are buying a foreclosure, the buyer has to pay for the occupancy inspection and then has to take care of whatever the municipality wants to have done BEFORE the buyer can move in.
Web Reference: http://www.YourSTLHome.com