It all starts with borrowed money. If people only risked their own money then margin calls would not exist.
When the investor borrows money to invest and the investment falls in value, then the lender’s loan is at risk and the lender acts to protect it.
A margin is the amount of liquid assets (cash) that the investor must hold in relation to the value of its investments. And the margin is agreed between the lender and the investor when the loan is set up.
A margin call is when the lender tells the investor to honour the agreement because the value of the investment has fallen and the lender doesn’t like the increased risk of the investor never being able to repay the loan. The investor then has to either put more of their own money in or sell some of the assets.
The lender doesn’t have to wait for the investor to sell the assets. The lender can take matters into its own hands and sell them.
The very fact that the investments are falling in value means it is not a good time to be selling them. Selling them accelerates the fall and make the margin more difficult to maintain.
Spreading investments, not putting all one’s eggs in one basket, are the ways to avoid a meltdown. That and not borrowing money in the first place.