Generally speaking, bankruptcy is a legal tool. It allows you to eliminate or at least rearrange your debt. It gives you a legal option so that lenders have to work with you, and it can provide you with a fresh start. It's also potentially a tool that you can consider if you're facing foreclosure.
The two often go together. If your home is being foreclosed upon, it likely means there are some serious financial issues to deal with. You may be in debt to the point that you simply can't pay it off. Therefore, you stopped paying the mortgage to worry about simple things like keeping food on the table for your family.
The benefit of filing for bankruptcy is that it usually creates an automatic stay. This is a court order that lenders can't ignore. Essentially, it tells them that collection efforts --including foreclosure -- are on hold. The court has to work with you to get through the bankruptcy first.
This does not mean the foreclosure won't eventually continue. Bankruptcy may take four months. Then, if you still can't pay, it could kick back in.
However, it does buy you some time. It also allows you to use bankruptcy to get your finances in order. A Chapter 13 filing could make debt affordable with a repayment plan, for example, and then you can afford the mortgage payments again. This helps you avoid foreclosure entirely.
As you can see, it's crucial to know about all of the potential legal tools at your disposal and how you can wield them for the best results.
Source: FindLaw, "Facing Foreclosure? How Bankruptcy Can Help," accessed Nov. 02, 2017