If your HOA is trying to force a foreclosure on your condo or townhouse due to unpaid association fees, then it may be likely that they have a lien on the property. This may have been the result of some type of confession of judgment if you ever fell behind or due to the association suing you in civil court. Otherwise there may be some clause somewhere in your HOA paperwork that lets them sue you for a foreclosure if you fall behind on the association dues.
Either way, the HOA is attempting to collect the amount of money they are owed by you for utilizing the services of the HOA (such as they may be). Because you have been unable to pay them for whatever reason, they are now trying to sue you and request that the courts auction off your property to satisfy the unpaid fees. Even if the arrears only amount to a few hundred or thousand dollars, it is quite easy for creditors to force a foreclosure on a large asset such as a property — do not stop worrying just because the HOA fees may be such a small dollar amount.
Bankruptcy, when you file it, stops the collection of any debts you include in the bankruptcy filing until the debts are either discharged or you begin a legal payment plan through the courts. So, the HOA will have to halt any collection efforts if you file Chapter 13 bankruptcy, as long as you include your HOA debt in the petition. You are seeking legal protection from your creditors, and all of them, including the Homeowners Association, must stop trying to collect as long as the issue is in the bankruptcy court.
Thus, the HOA is acting to collect a debt that they are owed by pursuing foreclosure against you. Filing bankruptcy will force them to put their foreclosure process on hold until you work out an arrangement with them. In most cases, you will have to enter a 3-5 year payment plan through the court system to pay back the unpaid fees. If you make it through the plan, then you will have no worries about them foreclosing on the house because you will have paid back any amounts that you were behind. Not being behind means that there is no reason for foreclosure.
But, if you fall behind on the bankruptcy payments, the HOA can have the debt taken out of the filing and have the automatic stay released and begin foreclosure again from the point at which they left off before the bankruptcy. As well, you will be responsible for your regular HOA dues, in addition to the portion you are paying through the court payment plan. Therefore, it is a waste of time, not to mention severely damaging to your credit, to file Chapter 13 if you are unable to afford the regular payment plus a portion what you are behind.
You should probably consult with an attorney or other financial adviser to make sure you are doing everything correctly and work out a budget so you do not fall behind on the payment plan. Although it is possible to file bankruptcy on your own, there are many reasons why it may be a better idea to rely on professional legal advice during such a potentially stressful time. Foreclosure situations, whether they are from the original lender or another party such as the HOA, almost require outside assistance, even if just to make sure you have been as careful as possible and will not have your solution thrown out on a technicality.