Bariatric surgery in morbid obesity, either through sleeve gastrectomy (SG) or Roux-Y gastric bypass (RYGB), leads to sustainable weight loss, improvement of metabolic disorders and changes in intestinal microbiota. Yet, the relationship between changes in gut microbiota, weight loss and surgical procedure remains incompletely understood. We determined temporal changes in microbiota composition in 45 obese patients undergoing crash diet followed by SG (n = 22) or RYGB (n = 23). Intestinal microbiota composition was determined before intervention (baseline, S1), 2 weeks after crash diet (S2), and 1 week (S3), 3 months (S4) and 6 months (S5) after surgery. Relative to S1, the microbial diversity index declined at S2 and S3 (p < 0.05), and gradually returned to baseline levels at S5. Rikenellaceae relative abundance increased and Ruminococcaceae and Streptococcaceae abundance decreased at S2 (p < 0.05). At S3, Bifidobacteriaceae abundance decreased, whereas those of Streptococcaceae and Enterobacteriaceae increased (p < 0.05). Increased weight loss between S3-S5 was not associated with major changes in microbiota composition. No significant differences appeared between both surgical procedures. In conclusion, undergoing a crash diet and bariatric surgery were associated with an immediate but temporary decline in microbial diversity, with immediate and permanent changes in microbiota composition, independent of surgery type