Ankylosing spondylitis is an autoimmune disease. No one knows exactly what causes it, and there is no cure. There is no guaranteed way to prevent fusion of the spine. However, there are many treatments, and some of the new medications that are used for things like rheumatoid arthritis are used to treat AS. These do not cure, but they can slow progression of your AS. We have a good overview: https://www.empowher.com/condition/ankylosing-spondylitis/definition
Do you see a rheumatologist? That is the specialty that manages AS. It is important to have an ongoing relationship with a rheumatologist to help prevent complications. AS can affect other parts of your body as well, and a rheumatologist knows what to watch for.
Physical activity is important as well. An exercise program customized to your AS situation will help you maintain good posture which is so important as AS often causes painful kyphosis, or the hunching forward of your spine.
The Spondylitis Association of America has some really good information on treatment as well as support for those with spondylitis. They are a great resource: http://www.spondylitis.org/about/as_treat.aspx,
Treatment of AS has come a long way in the last few years. A good rheumatologist and physical therapy program can help you minimize pain and maximize function. If you have further questions, please let me know. Thank you for writing.