Ankylosing spondylitis (AS) is a type of axial inflammation. Over time, some patients develop spinal ankylosis and permanent disability; however, current treatment strategies cannot arrest syndesmophyte formation completely. Here, we used mesenchymal stem cells (MSCs) from AS patients (AS MSCs) within the enthesis involved in spinal ankylosis to delineate that the HLA-B27-mediated spliced X-box-binding protein 1 (sXBP1)/retinoic acid receptor-β (RARB)/tissue-nonspecific alkaline phosphatase (TNAP) axis accelerated the mineralization of AS MSCs, which was independent of Runt-related transcription factor 2 (Runx2). An animal model mimicking AS pathological bony appositions was established by implantation of AS MSCs into the lumbar spine of NOD-SCID mice. We found that TNAP inhibitors, including levamisole and pamidronate, inhibited AS MSC mineralization in vitro and blocked bony appositions in vivo. Furthermore, we demonstrated that the serum bone-specific TNAP (BAP) level was a potential prognostic biomarker to predict AS patients with a high risk for radiographic progression. Our study highlights the importance of the HLA-B27-mediated activation of the sXBP1/RARB/TNAP axis in AS syndesmophyte pathogenesis and provides a new strategy for the diagnosis and prevention of radiographic progression of AS.