Major histocompatibility complex class I (MHCI) molecules negatively regulate cortical connections and are implicated in neurodevelopmental disorders, including autism spectrum disorders and schizophrenia. However, the mechanisms that mediate these effects are unknown. Here, we report a novel MHCI signaling pathway that requires the myocyte enhancer factor 2 (MEF2) transcription factors. In young rat cortical neurons, MHCI regulates MEF2 in an activity-dependent manner and requires calcineurin-mediated activation of MEF2 to limit synapse density. Manipulating MEF2 alone alters synaptic strength and GluA1 content, but not synapse density, implicating activity-dependent MEF2 activation as critical for MHCI signaling. The MHCI-MEF2 pathway identified here also mediates the effects of a mouse model of maternal immune activation (MIA) on connectivity in offspring. MHCI and MEF2 levels are higher, and synapse density is lower, on neurons from MIA offspring. Most important, dysregulation of MHCI and MEF2 is required for the MIA-induced reduction in neural connectivity. These results identify a previously unknown MHCI-calcineurin-MEF2 signaling pathway that regulates the establishment of cortical connections and mediates synaptic defects caused by MIA, a risk factor for autism spectrum disorders and schizophrenia.