Bankruptcy can delay a foreclosure, but won't stop it permanently. Here's how it works: When you file bankruptcy, the court automatically issues an "automatic stay." The automatic stay directs your creditors to cease all collection activities and foreclosures immediately. If your home is scheduled for a foreclosure sale, the sale will be postponed while the bankruptcy is pending -- typically for three to four months.
However, if your lender obtains the bankruptcy court's permission to proceed with the sale (by filing a "motion to lift the stay"), the sale may be allowed to go forward after a couple of months. But during a Chapter 7 bankruptcy, you can live in your home for free for several months while your bankruptcy is pending. You can then use that money to help secure new shelter. For more information, see Nolo's article How Bankruptcy Can Help With Foreclosure.
If you're having trouble making your mortgage payments or already in jeopardy of foreclosure, see Nolo's Bankruptcy and Foreclosure Blog or the bestselling Foreclosure Survival Guide, now available online at no charge. Both are written by attorney Stephen R. Elias, president of the National Bankruptcy Law Project.