The phenomenon that adverse environmental exposures in early life are associated with increased susceptibilities for many adult, particularly metabolic diseases, is now referred to as ‘developmental origins of health and disease (DOHAD)’ or ‘Barker’ hypothesis. Fetal overnutrition and undernutrition have similar long-lasting effects on the setting of the neuroendocrine control systems, energy homeostasis, and metabolism, leading to life-long increased morbidity. There are sensitive time windows during early development, where environmental cues can program persistent epigenetic modifications which are generally assumed to mediate these gene–environment interactions. Most of our current knowledge on fetal programing comes from animal models and epidemiological studies in humans, in particular the Dutch famine birth cohort. In industrialized countries, there is more concern about adverse long-term consequences of fetal overnutrition, i.e. by exposure to gestational diabetes mellitus and/or maternal obesity which affect 10–20% of pregnancies. Epigenetic changes due to maternal diabetes/obesity may predispose the offspring to develop metabolic disease later in life and, thus, transmit the adverse environmental exposure to the next generation. This vicious cycle could contribute significantly to the worldwide metabolic disease epidemics. In this review article, we focus on the epigenetics of an adverse intrauterine environment, in particular gestational diabetes, and its implications for the prevention of complex disease.