Ankylosing spondylitis is primarily a disorder of the spine, but can affect other joints of the body including the foot, mostly commonly causing heel pain or an inflammatory arthritis in the midfoot joints.
If there is pain in the heel and the joints of the foot and ankylosing spondylitis is already diagnosed elsewhere in the body, then there is a high probability that this pain in the foot could be due to the ankylosing spondylitis. Typically in these cases the pain affects both feet and not just one foot.
If there is pain in the foot, especially both feet and there is something not quite right about the pattern of the symptoms not matching common reasons for the foot pain and there is a history of an insidious onset of low back pain and other bone and joint symptoms or perhaps some eye irritation, then systemic causes of the pain need to be investigated or ruled out. One of those possible systemic causes could be ankylosing spondylitis and can be investigated further by a rheumatologist.
Keep in mind, that just because foot pain develops in someone who has ankylosing spondylitis, then they could have that foot pain for one of the more common reasons and the pain has nothing to do with the ankylosing spondylitis. It will need a skilled clinician to tease this out and arrive at a diagnosis.