Autism, a disorder influenced by both genetic and environmental factors, presents significant challenges for prevention and treatment. While maternal-infant gut microbiota has been a focus in autism research, preventive strategies targeting maternal gut microbiota remain underexplored. This study demonstrates that prenatal probiotic intake can effectively prevent maternal separation-induced autistic-like behaviors in offspring without altering the embryonic neurodevelopment in mice. Using specific PCR primers and cross-fostering experiments, we traced the vertical transmission of probiotics, primarily via fecal/vaginal contamination. Early probiotic colonization conferred resilience against stress-induced gut pathogenic microbes and Th17-mediated peripheral inflammation while significantly inhibiting hypermyelination and neuroinflammation linked to systemic inflammation. Microbial metabolites like tyrosol and xanthurenic acid alleviated neuroinflammation and hypermyelination in vitro, though the causal relationship among neuroinflammation, hypermyelination, and autism in vivo requires further validation. These findings underscore the importance of the maternal-infant microbiota transmission window in autism prevention and highlight the clinical potential of prenatal probiotic interventions.