Critical illness can significantly alter the composition and function of the human microbiome, but few studies have examined these changes over time. Here, we conduct a comprehensive analysis of the oral, lung, and gut microbiota in 479 mechanically ventilated patients (223 females, 256 males) with acute respiratory failure. We use advanced DNA sequencing technologies, including Illumina amplicon sequencing (utilizing 16S and ITS rRNA genes for bacteria and fungi, respectively, in all sample types) and Nanopore metagenomics for lung microbiota. Our results reveal a progressive dysbiosis in all three body compartments, characterized by a reduction in microbial diversity, a decrease in beneficial anaerobes, and an increase in pathogens. We find that clinical factors, such as chronic obstructive pulmonary disease, immunosuppression, and antibiotic exposure, are associated with specific patterns of dysbiosis. Interestingly, unsupervised clustering of lung microbiota diversity and composition by 16S independently predicted survival and performed better than traditional clinical and host-response predictors. These observations are validated in two separate cohorts of COVID-19 patients, highlighting the potential of lung microbiota as valuable prognostic biomarkers in critical care. Understanding these microbiome changes during critical illness points to new opportunities for microbiota-targeted precision medicine interventions.