Climate change and climate‐driven increases in infectious disease threaten wildlife populations globally. Gut microbial responses are predicted to either buffer or exacerbate the negative impacts of these twin pressures on host populations. However, examples that document how gut microbial communities respond to long‐term shifts in climate and associated disease risk, and the consequences for host survival, are rare. Over the past two decades, wild meerkats inhabiting the Kalahari have experienced rapidly rising temperatures, which is linked to the spread of tuberculosis (TB). We show that over the same period, the faecal microbiota of this population has become enriched in Bacteroidia and impoverished in lactic acid bacteria (LAB), a group of bacteria including Lactococcus and Lactobacillus that are considered gut mutualists. These shifts occurred within individuals yet were compounded over generations, and were better explained by mean maximum temperatures than mean rainfall over the previous year. Enriched Bacteroidia were additionally associated with TB exposure and disease, the dry season and poorer body condition, factors that were all directly linked to reduced future survival. Lastly, abundances of LAB taxa were independently and positively linked to future survival, while enriched taxa did not predict survival. Together, these results point towards extreme temperatures driving an expansion of a disease‐associated pathobiome and loss of beneficial taxa. Our study provides the first evidence from a longitudinally sampled population that climate change is restructuring wildlife gut microbiota, and that these changes may amplify the negative impacts of climate change through the loss of gut mutualists. While the plastic response of host‐associated microbiotas is key for host adaptation under normal environmental fluctuations, extreme temperature increases might lead to a breakdown of coevolved host–mutualist relationships.