Margin is the amount of money set aside to open and maintain a trade, calculated in the currency of your trading account. The required margin depends on the trading instrument and the leverage set on your account. It is not a fee or transaction cost and will be returned once the position is closed—provided there are no significant losses that the margin had to cover.
Think of margin as a good faith deposit required to keep positions open. To initiate any trade (Buy or Sell), you must have sufficient funds as security with your broker.
Margin requirements vary across currency pairs, but MT4/MT5 automatically calculates them for you. You can view the required margin in the margin field of your open positions within the MT4/MT5 terminal window.