The term toe rag was thought to have derived from English convict colonies circa mid-19th century when prisoners were not issued socks with their shoes. Prison issue footwear was straight lasted and required to be broken in and the absence of sock made this all the more painful. Convicts tied bits of their prison shirt around the toes and feet to make a make shift sock or "toe rag."
This was first recorded in J F Mortlock’s book Experiences of a Convict , published in 1864.
“Stockings being unknown, some luxurious men wrapped round their feet a piece of old shirting, called, in language more expressive than elegant, a ‘toe-rag’”
By metonymy, the term toe rag came to mean scoundrel, criminal, thief, indecent/unlawful person, and troublemaker.
"Come back with my wallet you little toe rag"
Foot bandages were commonly used by Dutch military in the 18th century. After touring Europe, Peter the Great (1672-1725) took the idea back to Russia and introduced Portyanki to the Russian military. In theory wrapping bandages around the foot gave greater support to the foot and adjusting the tension allowed dry air to be trapped within the wraps which helped insulate the foot, keeping them warm and dry. When the wraps got wet either by sweat (most likely) or soaked by rain the damp foot wrap section was rewound to the leg and the drier leg section wrapped around the foot. Left unwashed, the foot raps would smell and be worn until they disintegrated.
The epithet again appears in print in 1875, when T Frost in his book, Circus Life refers to toe rags as “the lower grades of circus men, and the acrobats who stroll about the country, performing at fairs."
Toe rag can also mean something squalid and disgusting; and by extension refer to lower classes or a bum, vagrant or tramp. A contemptible or worthless person.
An alternative origin which pre-dates make-shift socks comes from the early 17th century and describes a length of rope (toe rag or tow rag) which dangled in the sea water at the head of a sailing ship. In the absence of WC facilities, there was, a hole which over hanged the water at the head of the ship. This was the designated toilet on board and the sailors used the end of the rope to wipe their rear end. In naval parlance the WC was euphemistically called the Head.
Popularity of Cockney Slang was reprised in the 50s when the Angry Young man movement of playwrights, then later TV script writers of popular 70s series such as The Sweeney, Minder and Only Fools and Horses were unable to use swear words because of the censorship laws. Instead they plundered the lexicon of old Victorian slang and this caught on in popular vernacular.
The state of someone’s feet seems especially prominent in the vocabulary of derision. “Down at the heels” has been a metaphor for “destitute” or “failure” since the early 18th century, referring to worn shoes the owner lacks the funds to fix. Similarly, “to be on one’s uppers” is a 19th century phrase meaning “to be broke,” invoking the image of one so poor that the heels of his shoes have worn away entirely, leaving only the upper part of the shoe remaining. To call someone a “heel,” however, simply means that the person (usually an untrustworthy, unscrupulous man) has demonstrated that, as the heel is the lowest, rearmost portion of the foot, he is the lowest form of human being. One can be a “heel” and wear very nice shoes.
Mortlock, J. F. (John Frederick), 1809-1882. Experiences of a convict, transported for twenty-one years / by J.F. Mortlock ; edited by G. A. Wilkes and A. G. Mitchell. Sydney : Sydney University Press, 1965.