A link between urban living and disease is seen in recent and historical records, but the presence of this association in prehistory has been difficult to assess. If the transition to urban living does result in an increase in disease-based mortality, we might expect to see evidence of increased disease resistance in longer-term urbanized populations, as the result of natural selection. To test this, we determined the frequency of an allele (SLC11A1 1729 + 55del4) associated with natural resistance to intracellular pathogens such as tuberculosis and leprosy. We found a highly significantly correlation with duration of urban settlement—populations with a long history of living in towns are better adapted to resisting these infections. This correlation remains strong when we correct for autocorrelation in allele frequencies due to shared population history. Our results therefore support the interpretation that infectious disease loads became an increasingly important cause of human mortality after the advent of urbanization, highlighting the importance of population density in determining human health and the genetic structure of human populations.