Previous studies demonstrate an association between activation of the maternal immune system during pregnancy and increased risk of neurodevelopmental psychiatric conditions, such as schizophrenia and autism, in the offspring. Relatively recent findings also suggest that the gut microbiota plays an important role in shaping brain development and behavior. Here we show that maternal immune activation (MIA) accomplished by infection with a mouse-adapted influenza virus during pregnancy induced up-regulation of frontal cortex serotonin 5-HT2A receptor (5-HT2AR) density in the adult offspring, a phenotype previously observed in postmortem frontal cortex of schizophrenic subjects. 5-HT2AR agonist-induced head-twitch behavior was also augmented in this preclinical mouse model. Using the novel object recognition (NOR) test to evaluate cognitive performance, we demonstrate that MIA induced NOR deficits in adult offspring. Oral antibiotic treatment of prepubertal mice prevented this cognitive impairment, but not increased frontal cortex 5-HT2AR density or psychedelic-induced head-twitch behavior in adult MIA offspring. Additionally, gut microbiota transplantation from MIA mice produced behavioral deficits in antibiotic-treated mock mice. Adult MIA offspring displayed altered gut microbiota, and relative abundance of specific components of the gut microbiota, including Ruminococcaceae, correlated with frontal cortex 5-HT2AR density. Together, these findings provide a better understanding of basic mechanisms by which prenatal insults impact offspring brain function, and suggest gut-brain axis manipulation as a potential therapeutic approach for neurodevelopmental psychiatric conditions.