Children from low- and middle-income countries, where there is a high incidence of infectious disease, have the greatest need for the protection afforded by vaccination, but vaccines often show reduced efficacy in these populations. An improved understanding of how age, infection, nutrition, and genetics influence immune ontogeny and function is key to informing vaccine design for this at-risk population. We sought to identify factors that shape immune development in children under 5 years of age from Tanzania and Mozambique by detailed immunophenotyping of longitudinal blood samples collected during the RTS,S malaria vaccine phase 3 trial. In these cohorts, the composition of the immune system is dynamically transformed during the first years of life, and this was further influenced by geographical location, with some immune cell types showing an altered rate of development in Tanzanian children compared to Dutch children enrolled in the Generation R population-based cohort study. High-titer antibody responses to the RTS,S/AS01E vaccine were associated with an activated immune profile at the time of vaccination, including an increased frequency of antibody-secreting plasmablasts and follicular helper T cells. Anemic children had lower frequencies of recent thymic emigrant T cells, isotype-switched memory B cells, and plasmablasts; modulating iron bioavailability in vitro could recapitulate the B cell defects observed in anemic children. Our findings demonstrate that the composition of the immune system in children varies according to age, geographical location, and anemia status.