If you live in your spouse's house, a foreclosure on her mortgage will leave both of you homeless. Even if the bank forecloses on a second home or a rental instead, it's going to hurt your family's finances and your ability to take out loans. Given time and good money management, you can rebuild her credit and minimize the effects of foreclosure.
Foreclosure knocks down 85 to 160 points off a credit score. If the mortgage is only in your spouse's name, that won't affect your credit rating. It will make it harder for her to get credit, or for the two of you to get credit if you apply as a couple. It will be particularly difficult if your spouse is the primary breadwinner — so you need her income to qualify for the loan — or your credit reports already have some black marks on them.
Depending on your state's laws, your spouse's mortgage lender may be able to sue him for any part of the mortgage that remains unpaid after the foreclosure auction. If the lender wins, paying the debt will definitely affect you. If your spouse pays, the two of you will have a lot less money. If he can't pay and you live in a community property state, the lender may be able to collect from your share of the marital assets.
If the lender decides not to sue your spouse over any remaining debt, that doesn't end your worries. Say your lender had to write off $32,000 of the mortgage after the foreclosure auction. Federal tax law treats that as $32,000 in income. Your spouse — and you, if you file jointly — therefore owe income tax on the money. If the house is your primary home, you get an exemption — set to expire at the end of 2012 — but if it's a vacation home or a rental property, you're out of luck.
If your income and your credit score are good enough to get loans without your spouse on the application, that's one way to work around the effect of foreclosure. When you apply for a credit card, see if you can get his name on the card as an authorized user. That lets him use the card, but the responsibility for the bills is on your shoulders. Have your spouse concentrate on building her credit back up by regular payments on his own debts.