Microbiome establishment in newborn mammals is important for shaping their immune systems. CECs, a special type of red blood cell, suppress immune responses to normal microbiome development in the neonatal gut. Previous studies suggested that CECs help maintain the balance between gut microbes and the immune system. Yet, how the immune system accepts good gut bacteria after birth is still poorly understood. To close this gap, researchers characterized CECs in newborn and pregnant mice and explored how CECs influence microbiome development and diversity in these mice. The newborn mice had high numbers of CECs in the spleen and gut. Removing CECs from the intestine disrupted the microbiome-immune balance and caused inflammation in newborn mice, and these effects persisted for several weeks, especially in female mice. Depleting CECs also altered gut microbial diversity and abundance in pregnant mice. And fewer CECs were observed in cord blood from human preterm newborns, which may explain why dysbiosis occurs in these infants. The findings suggest that CECs help shape the gut microbiome during the neonatal period and pregnancy and suggest that modifying CEC function could prevent or alleviate inflammation and microbial imbalances in newborns.