The association between preoperative opioid or glucocorticoid (GC) use and clinical outcomes, such as postoperative mortality after total joint arthroplasty (TJA), is unclear. A population-based retrospective cohort study was conducted. Data were obtained from the National Health Insurance Service of South Korea. Patients who underwent TJA (total knee or total hip arthroplasty) between January 1, 2016, and December 31, 2021, were included. We examined whether the patients had been prescribed opioids or oral GC for > 90 days prior to TJA. In total, 664,598 patients who underwent TJA were included, among whom 245,260 (52.4%), 23,076 (3.5%), and 47,777 (7.2%) were classified into the opioid, GC, and opioid and GC groups, respectively. Compared to the non-user group, the opioid and GC user groups showed 53% (odds ratio [OR], 1.53; 95% confidence interval [CI], 1.12-2.30; P = 0.010) higher odds of in-hospital mortality. Compared to non-users, GC users (hazard ratio [HR], 1.24; 95% CI, 1.15-1.34; P < 0.001) and opioid and GC users (HR, 1.24; 95% CI, 1.14-1.35; P < 0.001) showed a higher risk of 1-year all-cause mortality. Compared to the non-user group, GC users (OR, 1.09; 95% CI, 1.04-1.15; P < 0.001) and opioid and GC users (OR, 1.06; 95% CI, 1.01-1.11; P = 0.014) showed higher odds of postoperative complications. Preoperative GC use and concomitant use of opioid analgesics with GC were associated with increased postoperative mortality and morbidity after TJA. However, preoperative chronic opioid analgesic use alone did not affect postoperative mortality or morbidity.