Hip fracture, which is associated with substantial morbidity and long-term mortality, imposes a major burden on the healthcare system. Diabetes is a risk factor for osteoporosis, which is a crucial risk factor of hip fracture. However, epidemiological studies investigating the risk of hip fracture among patients with type 2 diabetes are limited. This study explored the association between hemoglobin A1c (HbA1c) and the risk of hip fracture in people with type 2 diabetes aged 65 years and older. We conducted a retrospective cohort study of 20,025 older patients with type 2 diabetes who participated in the National Diabetes Case Management Program in Taiwan. The HbA1c level at the baseline and hip fracture incidence over an average of 7.41 years of follow-up were analyzed (maximum and standard deviation were 10.9 and 2.42 years, respectively). A total of 1514 hip fracture cases were recorded. The incidence rates of hip fracture were 9.15, 8.02, 9.58, 10.61, 12.51, and 13.43 per 1000 person-years in patients with baseline HbA1c levels of < 6%, 6-7%, 7%-8%, 8%-9%, 9%-10%, and ≥ 10%, respectively. After multivariate adjustment, the risk of hip fracture increased among patients with HbA1c levels of 9%-10% and ≥ 10.0% compared with patients with HbA1c levels of 6-7% (hazard ratio, 1.24; 95% confidence interval, 1.02-1.49 and 1.32; 1.09-1.58, respectively). Significant linear trends among various HbA1c levels were observed (P < 0.05). Patients with type 2 diabetes whose HbA1c levels exceeded 9.0% exhibited an increased risk of hip fracture, confirming a linear relationship. Our study's findings demonstrated the importance of glycemic control for fracture prevention in older adults with type 2 diabetes.