Alterations in the composition of the intestinal microbiota have been correlated with aging and measures of frailty in the elderly. However, the relationships between microbial dynamics, age-related changes in intestinal physiology, and organismal health remain poorly understood. Here, we show that dysbiosis of the intestinal microbiota, characterized by an expansion of the Gammaproteobacteria, is tightly linked to age-onset intestinal barrier dysfunction in Drosophila. Indeed, alterations in the microbiota precede and predict the onset of intestinal barrier dysfunction in aged flies. Changes in microbial composition occurring prior to intestinal barrier dysfunction contribute to changes in excretory function and immune gene activation in the aging intestine. In addition, we show that a distinct shift in microbiota composition follows intestinal barrier dysfunction, leading to systemic immune activation and organismal death. Our results indicate that alterations in microbiota dynamics could contribute to and also predict varying rates of health decline during aging in mammals.