Sodium-glucose cotransporter 2 inhibitors (SGLT2is) are known to improve cardiovascular and renal outcomes in patients with type 2 diabetes (T2D). Understanding the longitudinal patterns of adherence and the associated predictors is critical to addressing the suboptimal use of this outcome-improving treatment. To characterize the distinct trajectories of adherence to SGLT2is in patients with T2D and to identify patient characteristics and social determinants of health (SDOHs) associated with SGLT2i adherence. In this retrospective cohort study, we identified patients with T2D who initiated and filled at least 1 SGLT2i prescription according to 2012-2016 national Medicare claims data. The monthly proportion of days covered with SGLT2is for each patient was incorporated into group-based trajectory models to identify groups with similar adherence patterns. A multinomial logistic regression model was constructed to examine the association between patient characteristics and group membership. In addition, the association between context-specific SDOHs (eg, neighborhood median income and neighborhood employment rate) and adherence to an SGLT2i regimen was explored in both the overall cohort and the racial and ethnic subgroups. The final sample comprised 6,719 patients with T2D. Four trajectories of SGLT2i adherence were identified: continuously adherent users (49.6%), early discontinuers (27.5%), late discontinuers (14.5%), and intermediately adherent users (8.4%). Patient age, sex, race, diabetes duration, and Medicaid eligibility were significantly associated with trajectory group membership. Areas with a higher unemployment rate, lower income level, lower high school education rate, worse nutrition environment, fewer health care facilities, and greater Area Deprivation Index scores were found to be associated with low adherence to SGLT2is. Four distinct trajectories of adherence to SGLT2is were identified, with only half of the patients remaining continuously adherent to their treatment regimen during the first year after initiation. Several contextual SDOHs were associated with suboptimal adherence to SGLT2is.