ImportancePeriprosthetic joint infection (PJI) is a rare but devastating complication. Most patients undergoing total joint arthroplasty (TJA) also need routine screening colonoscopy, in which transient bacteremia may be a potential source for hematogenous PJI. Patients and surgeons must decide on an optimal time span or sequence for these 2 generally elective procedures, but no such guidelines currently exist.ObjectiveTo evaluate associations of colonoscopy with the risk of post-TJA PJI for the development of clinical practice recommendations for colonoscopy screening in patients undergoing TJA.Design, Setting, and ParticipantsThis retrospective cohort study of Military Health System (MHS) beneficiaries older than 45 years who underwent TJA from January 1, 2010, to December 31, 2016, used propensity score matching and logistic regression to evaluate associations of colonoscopy with PJI risk. Statistical analyses were conducted between January and October 2023.ExposureColonoscopy status was defined by Current Procedural Terminology code for diagnostic colonoscopy within 6 months before or 6 months after TJA.Main Outcomes and MeasuresPeriprosthetic joint infection status was defined by a PJI International Classification of Diseases code within 1 year after TJA and within 1 year from the post-TJA index colonoscopy date.ResultsAnalyses included 243 671 patients (mean [SD] age, 70.4 [10.0] years; 144 083 [59.1%] female) who underwent TJA in the MHS from 2010 to 2016. In the preoperative colonoscopy cohort, 325 patients (2.8%) had PJI within 1 year postoperatively. In the postoperative colonoscopy cohort, 138 patients (1.8%) had PJI within 1 year from the index colonoscopy date. In separate analyses of colonoscopy status within 6 months before and 6 months after TJA, younger age, male sex, and several chronic health conditions (diabetes, kidney disease, and pulmonary disease) were each associated with higher PJI risk. However, no association was found with PJI risk for perioperative colonoscopy preoperatively (adjusted odds ratio, 1.10; 95% CI, 0.98-1.23) or postoperatively (adjusted odds ratio, 0.90; 95% CI, 0.74-1.08).Conclusions and RelevanceIn this large retrospective cohort of patients undergoing TJA, perioperative screening colonoscopy was not associated with PJI and should not be delayed for periprocedural risk. However, health conditions were independently associated with PJI and should be medically optimized.