Many American families are facing the strains of the current economic crisis.  Adding to that many Americans are jobless, going through divorces or facing medical issues.  However, as bad as these times are they are not permanent.  Your current economic situation isn't permanent nor is this recession going to go on forever. You may be experiencing any of the above difficulties but depending on your particular situation it doesn't necessarily have to cost you your house.  Depending on the scope of your situation and what your long term goals are for your housing situation you may have viable options.  The following are some of the more popular options  that can be used to delay or even prevent foreclosure and the loss of your home.  
You may have received a letter of intent from your bank to foreclose your mortgage.  You may have already been served with a mortgage foreclosure lawsuit.  This does not mean you are going to lose your house any time soon.  Foreclosure is a lengthy process.  If properly defended and contested it can take months or depending on how vigorously you want to contest things it can take even a year or longer to conclude such a case.  This is time that you can use to weigh your options.  You can attempt to modify your loan with your bank while the foreclosure process is going on.  Doing this can slow down the whole process.  Depending on the County where the house is situated it can  greatly slow things down.  You may also want to use this time to orchestrate a sale of the house, or a short sale of the house, (where the bank takes less than what they are actually owed).  There are even government programs for short sales called HAFA.  You may also want to use this time to gather funds to work out a repayment plan with the bank.  If all else fails you can always file a personal bankruptcy or reorganization which will not only halt the foreclosure proceedings temporarily, thereby buying you more time in your house,  but depending on the type of bankruptcy you file, may also afford you a path to work out a repayment plan with your bank under the supervision of the bankruptcy court.  Depending on your situation, it is also possible that if you are able to secure a modification on your first mortgage you could then file a bankruptcy and rid yourself of 90% of what you owe on a second mortgage on that same house.
A skilled real estate attorney will work with an individual homeowner one on one to determine what  can be done, and what the homeowners want to do when they find they can no longer afford their mortgage payments.  An attorney can help work on a loan modification between you and your bank to lower your interest rate, your payments, and maybe even your principal balance.  There are in-house loan modifications provided by banks, as well as government modification programs like HAMP.   They can work with you to see which modification program(s) is available for you and which is the most likely to achieve success.  
As the name somewhat implies, a short sale is a way to sell your home for less than what you owe the bank and the bank agrees to release you based on that lower amount. The bank may also provide the Seller  a small amount of money in exchange for the homeowners' cooperation in this process. However, there are legal and tax consequences to a short sale that should be thoroughly examined before determining its viability for you.
When all else fails and you've exhausted all your foreclosure defenses, loan modification options, and short sale options you can still avail yourself to bankruptcy protection.  With certain notable exceptions, a Chapter 7 bankruptcy allows you to either rid yourself of most of your debt or, as in the case of a Chapter 13 bankruptcy, allows you to reorganize your debt and restructure it for either a three or five year repayment period. Utilizing either of these Chapters of the Bankruptcy Code will slow down the foreclosure process even further, as there is an immediate stay (stoppage) of all legal proceedings once your bankruptcy has been filed.  The timing and correct use of the proper bankruptcy laws is important in terms of slowing or stopping the foreclosure process on your property.
To a lesser extent these final options can sometimes quickly resolve a bad housing situation for people who just want to rid themselves of a bad housing situation.  In the context of these two options the home owner usually coordinates an uncontested  reconveyance of the property to the bank and conversely the bank decides not to pursue the homeowner with any further legal proceedings.  The bank may also pay the homeowner a small amount of money in exchange for their cooperation in this process.  However, contrary to what these options might imply, they are not a given and still require bank approval.