Introduction Pulmonary involvement is a known manifestation in patients with ankylosing spondylitis (AS). However, previous studies have been based on small samples and the reported prevalence and associations with typical clinical features vary. The purpose of this study was to compare pulmonary function (PF) in patients with AS and population controls, and to study associations between PF and disease related variables, cardio-respiratory fitness and demographic variables in patients with AS. Methods In a cross-sectional controlled study, 147 AS patients and 121 controls underwent examinations, including demographic variables, laboratory (C-reactive protein (CRP), erythrocyte sedimentation rate (ESR)) and clinical measures (disease activity (AS disease activity score, ASDAS), physical function (Bath ankylosing spondylitis functional index, BASFI), spinal mobility (Bath ankylosing spondylitis metrology index, BASMI), chest expansion, cardio-respiratory fitness (peak oxygen uptake, VO2peak) and pulmonary function test (PFT) (spirometry)). Cumulative probability plots were used to visualize associations between the ASDAS and BASMI scores and the corresponding forced vital capacity (FVC%, percentage of predicted value controlled for the influence of confounding factors) score for each patient. Univariate ANCOVAs were performed to explore group differences in PF adjusting for relevant variables, and a multiple regression model was used to estimate the explanatory power of independent variables (demographic, disease related, VO2peak) on restrictive ventilatory impairment (FVC%). Results AS patients showed significantly lower PF values compared with controls, and significantly more patients were categorized with restrictive pattern (18% vs. 0%, P < 0.001). Cumulative probability plots showed significant associations between spinal mobility measures (BASMI) and FVC% for individual patients. BASMI, chest expansion and male gender contributed significantly and independently in a multiple regression model predicting the variation of FVC% in AS patients, whereas disease activity, physical function and VO2peak did not contribute significantly. The final model explained 45% of the variance in FVC% (P < 0.001). Conclusions This study showed significantly impaired pulmonary function in the AS patients compared to controls and reference data, and demonstrated a clear relationship between reduced spinal mobility and restrictive PF in AS patients. The results support the assumption of an association between musculoskeletal limitations and restrictive respiratory impairment in AS, emphasizing the importance of maintaining spinal flexibility in the management of the disease. Further, patients with severely reduced spinal mobility should be referred for pulmonary function examination and relevant follow-up treatment.