Margin goes hand in hand with leverage. Leverage is the amount you can magnify your position, margin is the amount of money you have to put up to trade a position. Currently in the US, brokers can offer you 50:1 leverage and that equates to 2% margin. With 50:1 leverage you can trade $1000 by putting up $20 of your own money. $20 times the 50:1 leverage equals the $1000 you can trade. The $20 that you have put up is the margin required to hold the $1000 position. $20 out of the $1000 equals 2%, so the margin is 2%.
The less margin required, the higher leverage you have. An account that uses leverage is known as a Margin Account. The money you deposit in that account is your margin, and based on the money in your account, you can “borrow” as much as the leverage allows you to. 50 times, 100 times, maybe more, it depends on the leverage.
Once you place a trade, your broker has secured your margin as part of the trade. That money is no longer available until you close the trade and you then get your margin back. If you were to open a losing trade and your losses amounted to the remaining amount you have in your account, your trade(s) will automatically be closed. This is called a Margin Call. When you get a margin call, your losses are not the markets gain, but you do get the money you used as margin to open the trades back.
If you used $50 margin to open a trade and you get a margin call, you still get the $50 returned to you as part of the trade being closed. Use margin/leverage wisely, increased leverage and smaller required margin can be a double edged sword. What can gain you a lot of money can also lose you a lot of money if it goes the wrong way. Best regards