"To turn the tables" is a figure of speech meaning "to put someone else in the predicament that we have been occupying, or a into a similar one."

The term arose during the early 1600s, and seems to have been a reference to a card or board game in which a player, when at a disadvantage, might reverse the position of the board and thereby shift the disadvantage fo his opponent.

A similar possibility holds that the original sense of the expression might be the same as we now mean by "duplicate", as in the game duplicate bridge, wherein after a series of hands of cards had been played, the table was turned and the same series of hands was replayed, each player holding the hand previously held by an opponent.

There's another interesting theory that proposes that the expression is derived from an ancient fad in Roman men of purchasing costly tables. When a wife was chided for an expensive purchase of her own, then, she would "turn the tables" by reminding him of his extravagance.