The Queen of Hearts was a fictional character based on the queen of hearts playing card, taken from the book Alice Through the Looking Glass written by Lewis Carroll. (TAS: "Once Upon a Planet"; PIC: "Remembrance") In the book, she was quick to anger and favored ordering a beheading for those who infuriated her.
In 2269, the Queen of Hearts and several of her knaves were replicated as robots by the Shore Leave Planet's master computer, and appeared to Leonard McCoy with the intent of beheading him. (TAS: "Once Upon a Planet")
In the TAS episode, the Queen of Hearts was voiced by Majel Barrett.
In reality, the Queen appeared in Alice's Adventures in Wonderland, not its sequel. This might be due to the Queen of Hearts often being confused with the Red Queen.