Prenatal infection is an environmental risk factor for various brain disorders with neurodevelopmental components, including autism spectrum disorder and schizophrenia. Modeling this association in animals shows that maternal immune activation negatively affects fetal brain development and leads to the emergence of behavioral disturbances later in life. Recent discoveries in these preclinical models suggest that epigenetic modifications may be a critical molecular mechanism by which prenatal immune activation can mediate changes in brain development and functions, even across generations. This review discusses the potential epigenetic mechanisms underlying the effects of prenatal infections, thereby highlighting how infection-mediated epigenetic reprogramming may contribute to the transgenerational transmission of pathological traits. The identification of epigenetic and transgenerational mechanisms in infection-mediated neurodevelopmental disorders appears relevant to brain disorders independently of existing diagnostic classifications and may help identifying complex patterns of transgenerational disease transmission beyond genetic inheritance. The consideration of ancestral infectious histories may be of great clinical interest and may be pivotal for developing new preventive treatment strategies against infection-mediated neurodevelopmental disorders.