Measures of community population composition, such as residential segregation, are important theoretical mechanisms that have the potential to explain differences in fertility between immigrants, their descendants, and destination natives. However, only a handful of studies explore these mechanisms, and most are limited by the fact that they carry out cross‐sectional analysis. This study proposes a new approach, which focuses on community composition in childhood. It uses longitudinal census data and registered births in England and Wales to investigate the relationship between completed fertility and multiple measures of community composition, including residential segregation. The results show that the fertility of immigrants is closer to native fertility if they grow up in less segregated areas. This provides evidence in support of the childhood socialisation hypothesis. Furthermore, residential segregation explains some of the variation in completed fertility for second‐generation women from Pakistan and Bangladesh, the only second‐generation group to have significantly higher completed fertility than natives. This suggests one reason why the fertility of some South Asians in England and Wales may remain “culturally entrenched.” All of these findings are consistent for different measures of community composition. They are also easier to interpret than the results of previous research because exposure is measured before childbearing has commenced, therefore avoiding many issues relating to selection, simultaneity, and conditioning on the future.