The answer, unfortunately, is "it depends."
Here are is a brief, very general summary of the foreclosure process.
1. A lien holder can sue for foreclosure. If the debtor feels they have not defense to foreclosure, they might allow the lien holder to obtain a default judgement. Otherwise, the suit follows the usual process leading to a foreclosure judgement. After a judgement of foreclosure there is a period of redemption in which the debtor can pay off the mortgage holder and regain title. If the title is not redeemed, it will transfer.
2. Most foreclosures following the points below. However, a land contract can be strictly foreclosed, which returns title of the land to seller.
3. Except for strict foreclosures, a foreclosure judgement authorizes a foreclosure sale. The period of time between judgement and sale depends on many circumstances.
4. If the sheriffs sale attracts a bid, the bid is taken to the court for confirmation. The sale will be confirmed unless the court is convinced that the bid is substantially below the market value of the home.
5. When confirmed, the title passes to the highest bidder The new title holder has title free and clear of all liens except property taxes. So, as far as the new title holder is concerned, all of the mortgages "go away."
6. The proceeds of the sale are used to pay the cost of sale and then to pay off lien holders in order of priority. If there are sufficient funds to pay off both the first and second mortgage. In this case, the debtor has no further obligation to the second mortgage holder.
7. If there are insufficient funds to pay all of the liens, the debtor still owes the debt. There is no mortgage, but the debt can still be enforced by claiming the deficiency at the confirmation sale.
8. However, if a mortgage holder or other lien holder believes that the debtor will not be able to make a significant, timely payment of deficiency, they may forego their rights to a deficiency judgement.
I have outlined some general principals of law and some issues you might want to consider. Note the answer provided here is general information only and does not constitute legal advice with regard to any particular facts or circumstances. This information is not intended to substitute for professional legal advice and does not create an attorney-client relationship. You should accept legal advice only from a licensed legal professional with whom you have an attorney-client relationship. In my opinion, you should consult an attorney. If you cannot afford an attorney, you may be able to find an attorney who give you a reduced fee initial consult using the Wisconsin Bar Lawyer Referral and Information Service at www.wisbar.org/bar/lris.