I'll give an answer with the caveat that I haven't used the system in over 10 years. So maybe do some additional research.
The Collins Proline Flight Director used on the 200 (it's not the Autopilot per se, it's the Flight Director telling the AP what to do), and most similar ones I would expect, needs heading, bank angle and turn rate data to anticipate and judge correction heading offsets, intercept angles, etc, to track navigation solutions whether on "white needles" (FMS navigation) or "green needles" (direct radio signal navigation like VOR or LOC).
If you think about it, it has to; the Flight Director is substituting for your brain, and it needs the same data, about where the airplane is headed and how much it's turning, that you would need to hand fly an approach on raw data.
If you're hand flying and drifting to the left of the loc, you mentally estimate the heading change needed to re-intercept the loc, fly the new heading and wait. Without compass information you would have a pretty tough time doing it with any efficiency. If your heading indication did the same thing while you were hand flying, you would probably end up doing something similar if you kept trying to fly the LOC by ignoring the heading indication.
So if the AHRS gyrocompass unit the Flight Director is slaved to starts to slew on its own, it'll get confused and go into a kind of software loop with the resulting S turns. I would assume that selecting XFER to select the opposite FD/AHRS system fixed the problem.