The causes of large variation in the sizes of HIV epidemics among countries in sub-Saharan Africa are not well understood. Here we assess the potential roles of late age at marriage and a long period of premarital sexual activity as population risk factors, using ecological data from 33 sub-Saharan African countries and with individual-level data from Demographic and Health Surveys (DHS) in Kenya and Ghana in 2003. The ecological analysis finds a significant positive correlation between HIV prevalence and median age at first marriage, and between HIV prevalence and interval between first sexual intercourse and first marriage. The individual-level analysis shows that HIV infection per year of exposure is higher before than after first marriage. These findings support the hypothesis of a link between a high average age at marriage and a long period of premarital intercourse during which partner changes are relatively common and facilitate the spread of HIV.