Here, the authors hypothesized that in utero exposure to maternal pro-inflammatory cytokines will have sex-dependent effects on specific brain circuitry regulating offspring's memory and immune function that will be retained across the lifespan. Using a unique prenatal cohort, the authors tested this in 204 adult offspring, equally divided by sex, who were exposed/unexposed to an adverse in utero maternal immune environment and followed into early midlife. Functional magnetic resonance imaging results showed exposure to pro-inflammatory cytokines in utero was significantly associated with sex differences in brain activity and connectivity underlying memory circuitry and performance and with a hyperimmune state, 50 years later. Predictive validity of prenatal exposure was underscored by significant associations with age 7 academic achievement, also associated with age 50 memory performance. Results uniquely demonstrated that adverse levels of maternal in utero pro-inflammatory cytokines during a critical period of the sexual differentiation of the brain produced long-lasting effects on immune function and memory circuitry/function from childhood to midlife that were sex-dependent, brain region-specific, and, within women, reproductive stage-dependent.