Although ankylosing spondylitis causes are unknown, there appears to be a genetic prevalence to the disease (transmitted from parents to children) for most people. Many children with this disease were born displaying a given HLA-B27 gene. However, if the gene is present, that does not mean the disease has to be specifically there too. Recent studies have shown that both environmental as well as infectious factors have a role in triggering this disease.
Source: HLA-B27 Blog