Pole-swapping algorithms are generalizations of bulge-chasing algorithms for the generalized eigenvalue problem. Structure-preserving pole-swapping algorithms for the palindromic and alternating eigenvalue problems, which arise in control theory, are derived. A refinement step that guarantees backward stability of the algorithms is included. This refinement can also be applied to bulge-chasing algorithms that had been introduced previously, thereby guaranteeing their backward stability in all cases.