Both gestational cortisol exposure (GCE) and variability in postnatal environments can shape the later‐life behavioral and endocrine outcomes of the hypothalamic‐pituitary‐adrenal (HPA) axis. We examined the influence of GCE and social play on HPA functioning in developing marmosets. Maternal urinary cortisol samples were collected across pregnancy to determine GCE for 28 marmoset offspring (19 litters). We administered a social separation stressor to offspring at 6, 12, and 18 months of age, during which we collected urinary cortisol samples and behavioral observations. Increased GCE was associated with increased basal cortisol levels and cortisol reactivity, but the strength of this relationship decreased across age. Increased social play was associated with decreased basal cortisol levels and a marginally greater reduction in cortisol reactivity as offspring aged, regardless of offspring GCE. Thus, GCE is associated with HPA functioning, but socially enriching postnatal environments can alter the effects associated with increased fetal exposure to glucocorticoids. © 2014 Wiley Periodicals, Inc. Dev Psychobiol 56: 1229–1243, 2014.