“Shake a leg” means to get started, rouse yourself, hurry up, get out of bed. It was explicitly defined that way in the New York Magazine in 1904, and is usually used as a command or request.
“Shake a leg” also means to dance. That meaning may have evolved from “shake a heel,” or “shake a foot,” which were 1660s terms meaning to dance. There are several examples from both US and UK sources from the mid 1800s that relate to dancing. One is from the Dubuque Democratic Herald, October 1863, in an advertisement for a local ball: “Nearly every man in town able to shake a leg has purchased a ticket.”
“Show a leg” is a similar phrase, meaning “make an appearance,” (usually by getting out of bed or at least poking your leg out) or, very occasionally, “hurry along.” Most reports say the phrase originated with the Royal Navy and that this was the order given to sailors to put a foot out of their hammocks and get up.
Another theory about “show a leg” derives from the fact that women were allowed on board Royal Navy ships in the 1800s. The order of “show a leg” was given so that a woman’s shapely leg could be distinguished from a sailor’s hairy leg.
An example of “show a leg” appeared in print in 1891. John Masefield (Poet Laureate) was a trainee mariner on HMS Conway and reported the full version of the morning call as:
“Heave out, heave out, heave out, heave out! Away!
Come all you sleepers, Hey!
Show a leg and put a stocking on it.”
Here is an earlier example, from Cuthbert Bede, in The Adventures of Mr. Verdant Green, 1854:
“I would answer Robert when he hammered at the door; but, instead of getting up, I would knock my boots against the floor… But that wretch of a Robert was too old a bird to be caught with this dodge; so he used to sing out, ‘You must show a leg, sir!’ and he kept on hammering at the door till I did.”
Though “shake a leg” and “show a leg” are both used sometimes to mean “hurry up,” the two phrases don’t appear to be related.
There is a theory that the origin of “shake a leg” comes from the American Civil War. Supposedly, after a battle, when stretcher-bearers were out in the field collecting the wounded, they would shake a leg or arm of a victim to see if he responded, thus learning whether he was alive or dead. It’s an imaginative story, but there’s no proof that it’s true.
“Shake a Leg” is also a song, by Roll Deep. It was a song my mother sang, too, and it always meant “hurry up!”