Is this a new installation? Or an old one that started to have this problem?
If new, the wall may not be flat, and shims probably would help. If the wall is flat, either new or old, and the toilet moves, either the bolts are loose, or the blocking that holds it up is too weak or decayed (maybe a leak internal to the wall?).
Ideas from a non-pro...