When a person buys a house, he usually borrows money in afford the property. Some people can pay cash, but most people have to borrow money.
People have to pay a down payment for the house, and borrow the rest.
By signing a mortgage contract the person agrees,that if he was late making his monthly payments ( the interest and part of the borrowed principal), so the one who provided the loan money can sell the property in the auction and use the money to cover the loan balance.
Foreclosure is the legal process when a lender revokes (or forecloses) a borrower’s right to recover the mortgaged property. The borrower can still get the property back by paying off the entire loan plus foreclosing expenses, but only until the date set by the court. If the owner doesn’t do pay of the loan,so the lender can sell property. Lender applies the received money from the sale to the due amount and pays the left to the borrower. If the money from the sale is not enough to pay of entire debt, the borrower remains liable for the due amount.