Prenatal under-nutrition involves changes in the epigenetic regulation of specific genes. Maternal magnesium (Mg) deficiency affects maternal glucocorticoid metabolism, but the mechanisms underlying changes in glucocorticoid homeostasis of offspring are not well understood. In this study, we investigated the effects of feeding pregnant rats a Mg-deficient diet (0.003% magnesium) on the methylation of cytosine-guanine (CpG) dinucleotides in hepatic glucocorticoid genes of neonatal offspring, compared with controls (0.082% magnesium). Methylation of CpG dinucleotides in the peroxisome proliferator-activated receptor α (Ppara), glucocorticoid receptor (Nr3c1) and 11β-hydroxysteroid dehydrogenase-2 (Hsd11b2) promoters in the liver were measured by pyrosequencing. Quantitative real-time PCR was used to assess hepatic mRNA expression of each gene. Mean methylation of the Hsd11b2 promoter in the Mg-deficient offspring (33.2%) was higher than in controls (10.4%). This was due to a specific increase at CpG dinucleotides 1 (20.0% vs. control 10.1%), 2 (58.8% vs. 17.0%), 3 (29.7% vs. 6.2%) and 4 (38.7% vs. 8.8%) (p < 0.05). Ppara and Nr3c1 methylation status and expression did not differ between the groups. No significant difference was noted between male and female pups, which were equally represented. Therefore, a Mg-deficient diet alters glucocorticoid metabolism, predicting higher hepatic intracellular glucocorticoid concentrations, and is possibly a key mechanism that induces the metabolic complications of Mg deficiency.