Margin trading is buying/selling something you do not own. The broker owns the underlying asset you trade and so he allows you trade and you pay him a fee called the spread/commission. However, the broker is aware that your trade may end up in a loss (95% of retail traders lose money), so he asks you to deposit some little money as collateral and he warns you that if your losses exceed your collateral deposit, you will be required to deposit more funds (margin call requirement) failing which your trade will be closed. But, if your trade ends in a profit, your collateral will be released to you plus your profit.
Margin trading is widely used in both the stock market and CFD trading market. Every retail forex broker you see, offers margin to their customers because if they didn't, the cost of trading will be too high for the average trader like you and I. In the stock market, your collateral doesn't necessarily have to be cash you can deposit some stocks you own and if your trade is in a loss, the stockbroker may have to sell off your stock to cover any losses and keep your trade open.