Dental caries is an infectious disease that causes tooth decay. The high prevalence of dental caries in recent humans is attributed to more frequent consumption of plant foods rich in fermentable carbohydrates in food-producing societies. The transition from hunting and gathering to food production is associated with a change in the composition of the oral microbiota and broadly coincides with the estimated timing of a demographic expansion in Streptococcus mutans, a causative agent of human dental caries. Here we present evidence linking a high prevalence of caries to reliance on highly cariogenic wild plant foods in Pleistocene hunter-gatherers from North Africa, predating other high caries populations and the first signs of food production by several thousand years. Archaeological deposits at Grotte des Pigeons in Morocco document extensive evidence for human occupation during the Middle Stone Age and Later Stone Age (Iberomaurusian), and incorporate numerous human burials representing the earliest known cemetery in the Maghreb. Macrobotanical remains from occupational deposits dated between 15,000 and 13,700 cal B.P. provide evidence for systematic harvesting and processing of edible wild plants, including acorns and pine nuts. Analysis of oral pathology reveals an exceptionally high prevalence of caries (51.2% of teeth in adult dentitions), comparable to modern industrialized populations with a diet high in refined sugars and processed cereals. We infer that increased reliance on wild plants rich in fermentable carbohydrates and changes in food processing caused an early shift toward a disease-associated oral microbiota in this population.