BackgroundSuicide is a pressing public health problem, and firearm owners are at especially elevated risk. Certain health conditions are markers of suicide risk, but more research is needed on clinical risk markers for suicide among firearm owners specifically. Our goal was to examine associations of emergency department and inpatient hospital visits for behavioral and physical health conditions with firearm suicide among handgun purchasers.MethodsThis was a case–control study of 5415 legal handgun purchasers in California who died between January 1, 2008, and December 31, 2013. Cases were firearm suicide decedents; controls were motor vehicle crash decedents. Exposures were emergency department and hospital visits for six categories of health diagnoses in the 3 years prior to death. To account for selection bias due to deceased controls, we used probabilistic quantitative bias analysis to generate bias-adjusted estimates.ResultsThere were 3862 firearm suicide decedents and 1553 motor vehicle crash decedents. In multivariable models, suicidal ideation/attempt (OR 4.92; 95% CI 3.27–7.40), mental illness (OR 1.97; 95% CI 1.60–2.43), drug use disorder (OR 1.40; 95% CI 1.05–1.88), pain (OR 1.34; 95% CI 1.07–1.69), and alcohol use disorder (OR 1.29; 95% CI 1.01–1.65) were associated with higher odds of firearm suicide. When adjusting for all conditions simultaneously, only the associations for suicidal ideation/attempt and mental illness remained significant. Quantitative bias analysis indicated that observed associations were generally biased downward. For example, the bias-adjusted OR for suicidal ideation/attempt was 8.39 (95% simulation interval 5.46–13.04), almost twice that of the observed OR.ConclusionsDiagnoses for behavioral health conditions were markers for firearm suicide risk among handgun purchasers, even for conservative estimates that did not adjust for selection bias. Encounters with the healthcare system may provide opportunities to identify firearm owners at high risk of suicide.Supplementary InformationThe online version contains supplementary material available at 10.1186/s40621-023-00437-6.