Observational studies have shown an increased risk of ocular inflammatory diseases in patients with ankylosing spondylitis (AS), but the genetically predicted association remains unclear. The aim of this study was to systematically assess the causal relationship between AS and ocular inflammatory diseases. We conducted a two-sample Mendelian randomization (MR) analysis to investigate the causal relationship between AS and several common ocular inflammatory diseases based on genome-wide association study (GWAS) data and public health data. Five methods, namely, inverse-variance weighted (IVW), MR-Egger, weighted median, weighted mode, and simple mode, were used. Sensitivity analysis was performed using MR-Egger intercept, Mendelian Randomization Pleiotropy RESidual Sum and Outlier (MR-PRESSO), Cochran's Q test, outlier methods, leave-one-out analysis, and funnel plots. The MR analysis showed a significantly increased risk of uveitis (ORIVW = 2.825, 95%CIIVW = 1.709-4.672, and PIVW < 0.001), iridocyclitis (ORIVW = 3.806, 95%CIIVW = 2.809-5.157, and PIVW < 0.001), scleritis (ORIVW = 1.738, 95%CIIVW = 1.190-2.539, and PIVW < 0.001), and episcleritis (ORIVW = 5.113, 95%CIIVW = 2.067-12.645, and PIVW = 0.004) associated with AS. However, no correlation was found between genetically predicted AS and keratitis (ORIVW = 1.041, 95%CIIVW = 0.886-1.222, and PIVW = 0.628) and optic neuritis (ORIVW = 0.868, 95%CIIVW = 0.441-1.709, and PIVW = 0.682). AS increases the genetically predicted risk for uveitis, iridocyclitis, scleritis, and episcleritis. No potential association of AS with keratitis and optic neuritis was found. It may provide clues for the prevention of AS complications.