Actually, a second mortgage holder, or anyone creditor who has had the home pledged as collateral for a mortgage loan, can foreclose. The second mortgage holder does not have to buy out the first mortgage. The filing of a foreclosure notice, lis pendens or notice of default, is a directive to the local sherriff to force the sale of the property to satisfy outstanding mortgage debt. Who gets paid how much and in what order, from the proceeds, was probably established when the mortgages were initially setup.
Reference the article in the web reference for the foreclosure process when more than one mortgage exists. Very good reading, and I hope it is helpful.
Such a relevant question! In my limited recent experience, I'd say there are different possible outcomes for the second lienholder, depending on the proceeds available from the sale. For instance, in a short sale which must be approved by the lienholder(s), if there is not enough to pay all liabilities (any and all loans, taxes, commissions., etc) the first lienholder will dictate what the second lienholder can receive, if anything. We had a recent close in which the first had to accept dramatically less than what was owed in a short sale, and limited the second to receiving $1000, period. But, if the second doesn't accept the $1k, for example, it will almost certainly be 100 percent wiped out once the bank actually completes the foreclosure. So the second lienholders are accepting literally pennies on the dollar of what they are owed, if they are offered anything by the first in a short sale. I'm sure it differs around the country and every specific sale is different. This answer only scratches the surface of the issue... all of us in the industry are learning all the time, and new information seems available on a daily or weekly basis. All the best in your home search!