Objective To investigate whether bariatric surgery increases the risk of fracture.Design Retrospective nested case-control study.Setting Patients who underwent bariatric surgery in the province of Quebec, Canada, between 2001 and 2014, selected using healthcare administrative databases.Participants 12 676 patients who underwent bariatric surgery, age and sex matched with 38 028 obese and 126 760 non-obese controls.Main outcome measures Incidence and sites of fracture in patients who had undergone bariatric surgery compared with obese and non-obese controls. Fracture risk was also compared before and after surgery (index date) within each group and by type of surgery from 2006 to 2014. Multivariate conditional Poisson regression models were adjusted for fracture history, number of comorbidities, sociomaterial deprivation, and area of residence.Results Before surgery, patients undergoing bariatric surgery (9169 (72.3%) women; mean age 42 (SD 11) years) were more likely to fracture (1326; 10.5%) than were obese (3065; 8.1%) or non-obese (8329; 6.6%) controls. A mean of 4.4 years after surgery, bariatric patients were more susceptible to fracture (514; 4.1%) than were obese (1013; 2.7%) and non-obese (3008; 2.4%) controls. Postoperative adjusted fracture risk was higher in the bariatric group than in the obese (relative risk 1.38, 95% confidence interval 1.23 to 1.55) and non-obese (1.44, 1.29 to 1.59) groups. Before surgery, the risk of distal lower limb fracture was higher, upper limb fracture risk was lower, and risk of clinical spine, hip, femur, or pelvic fractures was similar in the bariatric and obese groups compared with the non-obese group. After surgery, risk of distal lower limb fracture decreased (relative risk 0.66, 0.56 to 0.78), whereas risk of upper limb (1.64, 1.40 to 1.93), clinical spine (1.78, 1.08 to 2.93), pelvic, hip, or femur (2.52, 1.78 to 3.59) fractures increased. The increase in risk of fracture reached significance only for biliopancreatic diversion.Conclusions Patients undergoing bariatric surgery were more likely to have fractures than were obese or non-obese controls, and this risk remained higher after surgery. Fracture risk was site specific, changing from a pattern associated with obesity to a pattern typical of osteoporosis after surgery. Only biliopancreatic diversion was clearly associated with fracture risk; however, results for Roux-en-Y gastric bypass and sleeve gastrectomy remain inconclusive. Fracture risk assessment and management should be part of bariatric care.