The microbiome of the female reproductive tract has implications for women's reproductive health. We examined the vaginal microbiome in two cohorts of women who experienced normal term births: a cross-sectionally sampled cohort of 613 pregnant and 1,969 non-pregnant women, focusing on 300 pregnant and 300 non-pregnant women of African, Hispanic or European ancestry case-matched for race, gestational age and household income; and a longitudinally sampled cohort of 90 pregnant women of African or non-African ancestry. In these women, the vaginal microbiome shifted during pregnancy toward Lactobacillus-dominated profiles at the expense of taxa often associated with vaginal dysbiosis. The shifts occurred early in pregnancy, followed predictable patterns, were associated with simplification of the metabolic capacity of the microbiome and were significant only in women of African or Hispanic ancestry. Both genomic and environmental factors are likely contributors to these trends, with socioeconomic status as a likely environmental influence.