Alice first meets three cards (the 2, 5 and 7 of Spades) in the Queen's garden painting white roses red. One of them explains that they accidentally planted white roses, and because the queen hates white roses they have to paint them red or the Queen will behead them.
After the Queen arrives, she finds white roses and orders the execution of all three of them. Alice hides these 3 in a flowerpot, after this their fate is unknown. When Alice joins a game of croquet with the Queen and the other playing cards, the card soldiers act as arches. They have to leave being arches every time the Queen has an executioner drag the victim away.
They also appear in the trial where the Knave of Hearts is accused of stealing the Queen's tarts. In the book, the clubs are soldiers, the diamonds are courtiers, the spades are gardners, and the hearts are children