The background theory is that since the queen's head is on a penny, she'll drown if you drop a penny in a glass. So you have to drink it to save the queen. It spread to food - and not just liquid food. It's not uncommon to penny a dessert, whereby the victim has to eat it without using their hands.
Rules vary from place to place. I've been taught you can't penny someone while they're holding their glass, but to hold the glass for more than 30 seconds, or to cover the top, is to forfeit and you have to down the drink anyway. Some people (at stricter formals) apparently do verbal-pennying, where you just catch the victim's eye and mouth "pennying" or something.