Prenatal overexposure to glucocorticoids (GC) can lead to behavioral changes in adulthood. We aimed to explore the effects of gestational administration of vitamin D on the behavioral responses of dams and their offspring prenatally exposed to dexamethasone (DEX). Vitamin D (500UI) was given daily during the whole pregnancy (VD group). Half of the groups that received vitamin D were treated with DEX (0.1 mg/kg, VD + DEX group) daily between the 14th and 19th days of pregnancy. The corresponding control groups of progenitors were assigned (CTL and DEX groups, respectively). Maternal care and the dam's behaviors were evaluated during lactation. The offspring had developmental and behavioral parameters evaluated during lactation and at 3, 6, and 12 months of age. Gestational administration of vitamin D increased maternal care and had an anxiolytic-like effect on the dams, but the latter was blocked in DEX-treated dams. Prenatal DEX partially impaired neural development and caused an anxiety-like phenotype in the male and female offspring at 6 months, which was prevented by gestational administration of vitamin D. As well, gestational vitamin D improved memory just in the male offspring, but this response was suppressed by prenatal DEX. We concluded that gestational vitamin D could prevent anxiety-like behavior in adult male and female rats prenatally exposed to DEX, which might be, in part, a result of the maternal care improvement.