These terms are used to refer to using one's own legs and the action of walking as a means of conveyance. "He went by Shanks's Pony" is often used as being a slightly derogatory way of saying he had no better means of conveyance.
The origins of the saying are obscure but it is believed to be Scottish, the earliest known reference being to shanks’s nag in 1774. That was said to refer to the use of the shank, that part of the human leg between the knee and the ankle.
One popular theory cites "shank's mare" as deriving from a horse-drawn lawn mower, manufactured by Shanks & Co. Ltd. (founded 1853) which required that the human operator walk behind the device to guide the horse. However, delightful though that idea is, references to the phrase in Scottish literature pre-date the existence of the Shanks lawn mower.
P C Keith Palmer
19 hours ago