The game was probably invented in Britain and has been known there since at least the 1860s. It appears in Charles Dickens's 1861 novel Great Expectations, as the only card game Pip, the book's protagonist, as a child seems to know how to play.
A standard 52-card deck is divided equally between two players, and the two stacks of cards are placed on the table face down. The first player lays down his top card face up, and the opponent plays his top card, also face up, on it, and this goes on alternately as long as no ace or face card (King, Queen, or Jack) appears. These cards are called "penalty cards."
If either player turns up such a card, his opponent has to pay a penalty: four cards for an ace, three for a King, two for a Queen, or one for a Jack. When he has done so, the player of the penalty card wins the hand, takes all the cards in the pile and places them under his pack. The game continues in the same fashion, the winner having the advantage of placing the first card. However, if the second player turns up another ace or face card in the course of paying to the original penalty card, his payment ceases and the first player must pay to this new card. This changing of penalization can continue indefinitely. The hand is lost by the player who, in playing his penalty, turns up neither an ace nor a face card. Then, his opponent acquires all of the cards in the pile. When a single player has all of the cards in the deck in his stack, he has won.
Is there a non-terminating game of Beggar-My-Neighbour?
A longstanding question in combinatorial game theory asks whether there is a game of Beggar-My-Neighbour that goes on forever. This can happen only if the game is eventually periodic—that is, if it eventually reaches some state it has been in before. Some smaller decks of cards have infinite games, while others do not. John Conway once listed this among his anti-Hilbert problems, open questions whose pursuit should emphatically not drive the future of mathematical research. The search for a non-terminating game has resulted in "longest known games" of increasing length.
Morehead, Albert H.; Frey, Richard L.; Mott-Smith, Geoffrey (1991). The New Complete Hoyle Revised: The Authoritative Guide to the Official Rules of all Popular Games of Skill and Chance. London, New York, Sydney, Auckland, Toronto: Doubleday. p. 456. ISBN0-385-40270-8.