In rare cases, inflammation from ankylosing spondylitis can affect the bowels. This can cause stomach pain and diarrhea.