Muscle spasm and jerks like that are known as "myoclonus". They're quite common when drifting off to sleep - I have them then, and the jerks can be quite big, full-body jerks that make me lift out of the bed a few centimeters. Haven't heard about myoclonus associated with bathroom visits. I could imagine it has something to do with muscle relaxation, though - but I'm not a doctor.
I wouldn't think they are specifically AS-related. Myoclonus is associated with a large number of possible disorders, but more importantly occurs in perfectly healthy people, too.
_________________
Merlijn
Male, self-diagnosed - so perhaps I really am a mutant.