Environmental exposures throughout the life course, including nutrition, may induce phenotypic and epigenetic changes. There is limited information about how timing affects the nature of such effects induced by a specific nutritional exposure. We investigated the effect of increased exposure to folic acid before birth or during the juvenile–pubertal period in rats on the epigenetic regulation of glucose homeostasis. Rats were fed either a folic acid-adequate (AF; 1 mg/kg feed) or a folic acid-supplemented (FS; 5 mg/kg feed) diet from conception until delivery and then an AF diet during lactation. Juvenile rats were fed either the AF or the FS diet from weaning for 28 d and then an AF diet. Liver and blood were collected after a 12 h fast between postnatal days 84 and 90. Maternal FS diet increased plasma glucose concentration significantly (P < 0·05) in females, but not in males. Post-weaning FS diet decreased glucose concentration significantly in females, but increased glucose concentration in males. There were no effects of the FS diet on phosphoenolpyruvate carboxykinase (PEPCK) mRNA expression in males, while the pattern of expression was related to plasma glucose concentration in females. The FS diet induced specific changes in the methylation of individual CpG in females, but not in males, which were related to the time of exposure. Methylation of CpG − 248 increased the binding of CCAAT-enhancer-binding protein β to the PEPCK promoter. Together, these findings show that both the period during the life course and sex influence the effect of increased exposure to folic acid on the epigenetic regulation of PEPCK and glucose homeostasis.