Adherence to hydroxychloroquine (HCQ) treatment in patients with systemic lupus erythematous (SLE) is suboptimal. Although individual-level factors, including younger age and non-white race/ethnicity, have been implicated, contextual factors have not been explored. The aim of this study was to investigate the effect of contextual factors, including racial composition, socioeconomic status, and the concentration of health care resources, on adherence to HCQ among SLE patients enrolled in Medicaid. We identified SLE patients from 28 states in the US who enrolled in Medicaid (2000-2010) and in whom HCQ treatment was newly initiated (no use for ≥6 months). We required 12 months of continuous enrollment with complete drug dispensing data and measured adherence using the proportion of days covered (PDC). We identified individual-level variables from Medicaid, zip code-level, county-level and state-level sociodemographic variables from the American Community Survey, and health resources from Area Health Resources Files. We used 4-level hierarchical multivariable logistic regression models to examine the odds ratios (ORs) and 95% credible intervals (95% CrIs) of adherence (PDC ≥80%) versus nonadherence. Among 10,268 patients with SLE in whom HCQ treatment was initiated, 15% were adherent to treatment. After we adjusted for individual-level characteristics, we observed lower odds of adherence among patients living in zip code areas with a higher percentage of black individuals (highest tertile OR 0.81 [95% CrI 0.69-0.96] versus lowest tertile). This association persisted after controlling for area-level educational attainment, percent below federal poverty level (FPL), urbanicity, and health care resources. We did not observe statistically significant associations with zip code-level percent Hispanic, percent white, education, or percent below FPL. The odds of adherence were higher in counties with more hospitals (OR 1.30 [95% CrI 1.07-1.58]). Among Medicaid beneficiaries with SLE, we observed significant effects of racial composition and hospital concentration on HCQ adherence. Interventions that acknowledge and address contextual factors should be considered in order to reduce high rates of nonadherence in vulnerable populations.