ImportanceStudies have suggested a rise in opioid- and stimulant-involved overdoses in recent years in North America. This risk may be acute for individuals who have had contact with the criminal justice system, who are particularly vulnerable to overdose risk.ObjectiveTo examine the association of opioid and/or stimulant use disorder diagnoses with overdose (fatal and nonfatal) among people with histories of incarceration.Design, Setting, and ParticipantsIn this cohort study, population-based health and corrections data were retrieved from the British Columbia Provincial Overdose Cohort, which contains a 20% random sample of residents of British Columbia. The analysis included all people in the 20% random sample who had a history of incarceration between January 1, 2010, and December 31, 2014. Outcomes were derived from 5-years of follow-up data (January 1, 2015, to December 31, 2019). Statistical analysis took place from January 2022 to June 2022.ExposuresSubstance use disorder diagnosis type (ie, opioid use disorder, stimulant use disorder, both, or neither), sociodemographic, health, and incarceration characteristics.Main Outcomes and MeasuresHazard ratios (HRs) are reported from an Andersen-Gill model for recurrent nonfatal overdose events and from a Fine and Gray competing risk model for fatal overdose events.ResultsThe study identified 6816 people (5980 male [87.7%]; 2820 aged <30 years [41.4%]) with histories of incarceration. Of these, 293 (4.3%) had opioid use disorder only, 395 (6.8%) had stimulant use disorder only, and 281 (4.1%) had both diagnoses. During follow-up, 1655 people experienced 4026 overdoses including 3781 (93.9%) nonfatal overdoses, and 245 (6.1%) fatal overdoses. In adjusted analyses, the hazard of both fatal (HR, 2.39; 95% CI, 1.48-3.86) and nonfatal (HR, 2.45; 95% CI, 1.94-3.11) overdose was highest in the group with both opioid and stimulant use disorder diagnoses.Conclusions and RelevanceThis cohort study of people with a history of incarceration found an elevated hazard of fatal and nonfatal overdose among people with both opioid and stimulant use disorder diagnoses. This study suggests an urgent need to address the service needs of individuals who have had contact with the criminal justice system and who co-use opioids and stimulants.