Bariatric surgery is vital for sustainable weight loss and metabolic improvement in obese individuals, but its effects on gut microbiota and their role in these benefits require further investigation. Investigate the temporal changes in gut microbiota in obese patients undergoing bariatric surgery (gastric sleeve gastrectomy or Roux-en-Y Gastric Bypass (RYGB)) compared to healthy controls, aiming to understand their role in weight loss and metabolic health improvement. A case-control study included 30 obese patients aged 65–95 undergoing bariatric surgery, and 18 matched healthy controls. Selection criteria were based on age, race, BMI, history of antibiotics, probiotics, and prebiotics usage. Stool samples were collected at baseline, three months, and six months post-surgery for DNA extraction and quantitative real-time PCR analysis to assess gut microbiota changes. Physical activity and dietary intake were evaluated using standardized questionnaires. Statistical analyses were performed using R. Post-surgery, patients showed significant reductions in weight and BMI, with changes in dietary habits and physical activity. Quantitative real-time PCR analysis revealed substantial alterations in bacterial groups such as Bacteroides and Fusobacterium. However, some groups showed no significant changes, indicating a complex interaction between gut microbiota and bariatric surgery. Notable correlations were found between body weight, BMI, and specific bacterial groups like the C. cluster IV and Lactobacillus, particularly in RYGB patients. Bariatric surgery significantly alters gut microbiota, aiding weight loss and metabolic regulation in obese patients. Understanding these changes is crucial for developing effective obesity management strategies, requiring further research to optimize outcomes.