Cards. They're not just for fun and games anymore. Though we do still play them. Or at least talk about—and accuse others of—playing them, especially in politics.
People have been talking about "playing the race card" since as early as 1974, when an article in the British newspaper The Observer stated that "the Tory leadership declined to play the race card." That is, they declined to use the issue of race to their political advantage.
It looks like it was more than a decade later that the term gender card started showing up in the same kinds of contexts:
But Orren thinks if Murphy plays the gender card in her ads she will lose the broader coalition of votes needed to win the election.
—Renee Loth, The Boston Globe, 9 Aug. 1990
Though gender card has mostly been doing the job of referring to the act of using one's status as a woman to achieve a desired end (such as a campaign victory), the more pointed term woman card has also occasionally been used over the years. It's synonymous with the usual meaning of gender card but lacks the other term's polite ambiguity: while gender card may, in rare cases, be used to refer to the act of using one's status as a man to achieve a desired end, woman card is clearly partisan:
Ms Switzer's riposte is to play the "woman" card for all it is worth—she popped up on Woman's Hour recently and there was barely a whiff of politics.
—Helen Hague, The Independent [London], 7 Apr. 1991
Though apparently about as old as gender card, it wasn't until the 2016 U.S. presidential election cycle that the term woman card began to appear in published, edited text with any kind of frequency.
Race card, gender card, and woman card all get used with the verb play, which makes it clear that the metaphorical card in each case is a playing card.
But the card metaphor gets stretched, and the cards themselves get playfully construed in a variety of ways: as business card, greeting card, credit card. Alexandra Petri at the Washington Post imagined "the woman card" as a kind of "rewards" card—you know, like that card you show at the drugstore that reports to the drugstore company everything you buy in exchange for occasional discounts on toothpaste and candy bars. Petri dryly jokes about all the not-so-rewarding things the woman card gets women—including discounted earnings and higher prices for toiletries and the like.
But the heart of the metaphor continues to be the cards that have amused people since at least the 14th century: playing cards. The entertainment value of playing cards in the days before Netflix (and electricity) can't be underestimated, so it's no surprise that we've been using cards as metaphors for centuries, as is apparent in western literature:
"Napoleon has landed at Cannes." Such news might create a panic at Vienna, and cause Russia to drop his cards, and take Prussia into a corner.…
—William Makepeace Thackeray, Vanity Fair, 1848
As paired with modifiers, we have an early example in the term sure card, which the Oxford English Dictionary dates to the 16th century and defines as "an expedient certain to attain its object; a person whose agency, or the use of whose name, will ensure success," as in this example from Dickens:
'Capital!' said Mr Lenville: 'that's a sure card, a sure card. Get the curtain down with a touch of nature like that, and it'll be a triumphant success.'
—Nicholas Nickleby, 1839
Other adjectives were attached to card soon thereafter; someone could have a "good" or "safe" card in the same way as one had a sure card:
Thus he found another card in the hand the mad god had dealt him. How important that card was to become he did not dream, yet he decided that it was a pretty good card.
—Jack London, Burning Daylight, 1910
These terms never strayed far from the metaphorical card table: a sure card, a good card or a safe card was always one that would make success—often described in terms of winning the hand or the game—a stronger likelihood. (A trump card is, of course, similar. Literally, it's a card from the suit that has been chosen as the most valuable for a particular card game. Figuratively, it's something that gives someone an advantage; that use dates to the early 1800s.)
Between these, though, and our political trio—race card, gender card, and woman card—is a direct forebear likely unfamiliar to readers in the U.S.: playing the "Orange card" in the late 19th century was—and continues to be—to appeal to Northern Irish Ulster Unionists in order to gain political advantage. Winston Churchill's father, Lord Randolph Churchill, likely coined the term, thereby setting the lexical stage for the cards that have been dealt and played by our politicians and pundits since.