his phrase derives from the practice of bell ringing. Each pattern of the order of striking the bells is called a change. In order to 'ring the changes' all the variations of striking pattern are rung, bringing the ring back to its starting point.
Bell-ringing is of course an ancient pastime and consequently the figurative use of this phrase is also old. Thomas Adams refers to it in The divells banket described in sixe sermons, 1614
"Some ring the Changes of opinions."
The term took on another meaning in the 19th century. While acknowledging that "the expression originally came from the belfry" John C. Hotten's A Dictionary of Modern Slang, Cant, and Vulgar Words, 1859 glosses the meaning as:
"Ringing the Changes, changing bad money for good; in respectable society the phrase is sometimes employed to denote that the aggressor has been paid back in his own coin, as in practical joking, when the laugh is turned against the jester.