Well, we don't exactly "make" it because it's an element which can only be created in the cores of stars. (Maybe we could create a very small amount in particle accelerators, but it would be far too expensive to be practical.) Rather, we extract it from natural sources.
Magnesium can be extracted from a variety of minerals, most commonly magnesite, dolomite, brucite, bishoviete, carnallite, and olivine. It is generally extracted either by thermal reduction, which involves heating the mineral to extremely high temperatures until its chemical bonds separate and magnesium vapor is released (which can then be condensed into usable magnesium), or electrolysis, which uses electrical current to break the chemical bonds directly and separate the mineral into its constituent elements. Electrolysis is much more efficient, but it is also much more expensive due to the need for more capital investment and higher technology. As a result, rich countries like the US generally use electrolysis, while poor countries like China generally use thermal reduction.