Previous studies demonstrated unclear and vast variability in the association between Ankylosing Spondylitis (AS) and the risk of cancer. To assess the risk of overall and site-specific malignancies for AS patients in Israel, while examining the role of comorbidities and immunomodulatory therapy. We conducted a retrospective electronic data-based study including all AS patients diagnosed between 2002 and 2018, with no history of cancer prior to enrollment, with 5:1 ratio matched-control by age, gender, and place of residence. The odds Ratios (OR) for site-specific malignancies, comparing AS patients and controls, were calculated using logistic regression. Risk factors for malignancies within the AS cohort were evaluated in the same manner. This study comprised 5825 AS patients and 28,356 matched controls. There was a higher overall risk of cancer in AS patients compared to controls (OR = 1.4, 95% CI 1.24-1.6), specifically for solid malignancies (OR = 1.5, 95% CI 1.3-1.7), CNS (OR = 3.72, 95% CI 1.29-10.7), kidney (OR = 2.06, 95% CI 1.12-3.8), and malignancy of unknown primary (OR = 3.06, 95% CI 2.35-3.98). Regarding predictors for malignancy within AS patients, older age at diagnosis (OR = 1.31, 95%,CI 1.25-2.36), diabetes (OR = 1.52, 95% CI 1.18-1.97), IBD (OR = 2.61, 95% CI 1.75-3.89), and treatment with DMARDs (OR = 2.17, 95% CI 1.65-2.83) were associated with a higher risk of solid malignancies, while NSAIDs treatment alone had a protective effect for solid malignancies (OR = 0.78, 95% CI 0.61-0.99). No significant association was found between anti-TNF therapy and the risk of solid or hematologic malignancies within the AS group. AS is associated with an increased risk of overall and site-specific malignancies, with independently higher risk for older age, comorbidity of DM, IBD, and treatment with DMARDs.