A successful pregnancy depends on not only the tolerance of the fetal immune system by the mother but also resistance against the threat of hazardous microorganisms. Infection with pathogenic microorganisms during pregnancy may lead to premature delivery, miscarriage, growth restriction, neonatal morbidity, and other adverse outcomes. Moreover, the host also has an intact immune system to avoid these adverse outcomes. It is important to note the presence of normal bacteria in the maternal reproductive tract and the principal role of the maternal-placental-fetal interaction in antimicrobial immunity. Previous studies mainly focused on maternal infection during pregnancy. However, this review summarizes the new views on the study of the maternal microbiome and expounds the innate immune defense mechanism of the maternal vagina and decidua as well as how cytotrophoblasts and syncytiotrophoblasts recognize and kill bacteria in the placenta. Fetal immune systems, thought to be weak, also exhibit an immune defense function that is indispensable for maintaining the safety of the fetus. The skin, lungs, and intestines of the fetus during pregnancy constitute the main immune barriers. These findings will provide a new understanding of the effects of normal microbial flora and how the host resists harmful microbes during pregnancy. We believe that it may also contribute to the reference on the clinical prevention and treatment of gestational infection to avoid adverse pregnancy outcomes.