To evaluate the association of glycated haemoglobin (HbA1c) and serum glucose with intraocular pressure (IOP) in a large UK general population. Participants were selected from the UK Biobank, excluding those with eye conditions that may affect IOP. IOP was measured using an ocular response analyser. Goldmann-correlated IOP (IOPg) and corneal-compensated IOP (IOPcc) were outcomes of interest, and ocular hypertension was defined as left-eye IOPg or IOPcc > 21 mmHg. HbA1c and random (non-fasting) serum glucose were the exposures of interest. Multivariate restricted cubic spline models, as well as linear regression, were applied to explore the associations of interest. Among 68 806 participants (46.5% male), the mean age was 56.7 years. The mean (standard deviation) for IOPg was 15.7 (3.6) mmHg and 15.9 (3.6) mmHg for IOPcc. Occular hypertension was prevalent in 8055 participants (11.7%) and 4178 participants (6.1%) had diabetes. Those with diabetes had higher IOP and a higher prevalence of ocular hypertension. After adjustment for demographic and clinical variables, HbA1c was positively associated with IOP in participants with diabetes, but not in those without diabetes. For every 10-mmol/mol increase in HbA1c, IOPg increased by 0.20 mmHg (95% confidence interval [CI] 0.12, 0.28) and IOPcc by 0.15 mmHg (95% CI 0.07, 0.23); the odds of ocular hypertension was increased by 6% (95% CI 1.00, 1.13) in participants with diabetes. A borderline positive association between serum glucose and IOP was found only in participants without diabetes. Impaired glycaemic control was associated with elevated IOP and a possible risk of ocular hypertension among participants with diabetes but of normal ocular health.