Consider a real-life example of a margin of safety. Say you're planning a pyrotechnics show, which will include flames and explosions. You have concluded with a high degree of certainty that it's perfectly safe to stand 100 feet from the center of the explosions. But to be absolutely sure no one gets hurt, you implement a margin of safety by setting up barriers 125 feet from the explosions.
This use of a margin of safety works similarly in value investing. It's simply the practice of leaving room for error in your calculations of intrinsic value. A value investor may be fairly confident that a company has an intrinsic value of $30 per share. But in case his or her calculations are a little too optimistic, he or she creates a margin of safety/error by using the $26 per share in their scenario analysis. The investor may find that at $15 the company is an attractive investment, or he or she may find that at $24, the company is not attractive enough. If the stock's intrinsic value is lower than the investor estimated, the margin of safety would help prevent this investor from paying too much for the stock.