Our environment poses a constant threat to our health. To survive, all organisms must be able to discriminate between good (food ingredients and microbes that help digest our food) and bad (pathogenic microbes, viruses and toxins). In vertebrates, discrimination between beneficial and harmful antigens mainly occurs at the mucosal surfaces of the respiratory, digestive, urinary and genital tract. Here, an extensive network of cells and organs form the basis of what we have come to know as the mucosal immune system. The mucosal immune system is composed of a single epithelial cell layer protected by a mucus layer. Different immune cells monitor the baso-lateral side of the epithelial cells and dispersed secondary lymphoid organs, such as Peyer’s patches and isolated lymphoid follicles are equipped with immune cells able to mount appropriate and specific responses. This review will focus on the current knowledge on host, dietary and bacterial-derived factors that shape the mucosal immune system before and after birth. We will discuss current knowledge on fetal immunity (both responsiveness and lymphoid organ development) as well as the impact of diet and microbial colonization on neonatal immunity and disease susceptibility. Lastly, inflammatory bowel disease will be discussed as an example of how the composition of the microbiota might predispose to disease later in life. A fundamental understanding of the mechanisms involved in mucosal immune development and tolerance will aid nutritional intervention strategies to improve health in neonatal and adult life.