Heart failure (HF) is an increasingly prevalent disease in humans; it induces multiple symptoms and damages health. The animal gut microbiota has critical roles in host health, which might be related to HF symptoms. Currently, several options are used to treat HF, including non-invasive ventilation (NIV). However, studies on gut microbiota responses to acute HF and associated treatments effects on gut communities in patients are scarce. Here, short-term (1 week after treatments) and long-term (3 months after treatment) variations in gut microbiota variations in rats with acute HF treated were examined NIV through high-throughput sequencing of the bacterial 16S rRNA gene. Through comparison of gut microbiota alpha diversity, it was observed lower gut microbiota richness and diversity in animals with acute HF than in normal animals. Additionally, beta-diversity analysis revealed significant alterations in the gut microbiota composition induced by acute HF, as reflected by increased Firmicutes/Bacteroidetes (F/B) ratios and Proteobacteria enrichment. When network analysis results were combined with the null model, decreased stability and elevated deterministic gut microbiota assemblies were observed in animals with acute HF. Importantly, in both short- and long-term periods, NIV was found to restore gut microbiota dysbiosis to normal states in acute HF rats. Finally, it was shown that considerable gut microbiota variations existed in rats with acute HF, that underlying microbiota mechanisms regulated these changes, and confirmed that NIV is suitable for HF treatment. In future studies, these findings should be validated with different model systems or clinical samples.