One of the enzymes that requires magnesium is methionine synthase (MS), which catalyzes the conversion of homocysteine to methionine. Methionine, then, is converted to S-adenosylmethionine (SAM) which is the main methyl donor in the cell, it is used in many methylation reactions, including the methylation of DNA and proteins.
Additionally, magnesium also plays a role in the activity of enzymes that catalyze the methylation and demethylation of DNA, such as DNMTs (DNA methyltransferases) and TET enzymes. These enzymes are responsible for the addition or removal of methyl groups from DNA, which can affect the expression of genes.
Magnesium deficiency has been shown to disrupt methylation reactions, leading to changes in the expression of genes that are involved in DNA misfires.