I was under the impression that this phrase was a synonym for ‘walk the line’ but it isn’t. It means to conform to an established rule or standard or political program.
The term has been attributed to sports, including toeing the starting line in track events and toeing a center line in boxing, where boxers were instructed to line up on either side of to start a match. However, the earlier boxing term was ‘toeing the scratch,’ referring to a scratch mark on the floor. Anyone man enough to enter into such a contest was, of course, ‘up to scratch.’
In addition, there is a military and naval connection. In the 19th century, sailors were expected to prepare themselves for group punishment by standing in formation on deck and ‘toeing the line’ between boards - also called ‘toeing the crack.’ This latter usage is the was first used in print in The Edinburgh Literary Journal, January - June 1831.
The term is still in literal use in the military, particularly the US Army. Some barracks have two solid lines, each approximately three inches wide and placed five feet apart, either taped or painted, running down the center of the entire length of the floor. The soldiers are ordered to ‘toe the line.’ At this command they cease their activities and line up with their toes on the line. Again, on some military parade-grounds there are white lines marked, along which soldiers form up, with their toes just touching the line.
Since the phrase is used in connection with politics, some sources erroneously state that its origins lie in the British House of Commons where members wearing swords were instructed to stand behind lines that were two sword-lengths apart from their political rivals in order to maintain decorum. However, there is no record of a time when Members of Parliament were allowed to bring swords into the Chamber. Historically, only the Sergeant at Arms carries a sword as a symbol of his role in Parliament. There are loops of pink ribbon in the Members' cloakroom for MPs to hang up their swords before entering the Chamber to this very day as a result of this rule. And, in fact, there were no lines on the floor of the Chamber in the days that gentlemen (or ladies) carried swords.
There is no definitive word on the original source of the phrase, nor when it might first have been employed, but it’s obviously been used a lot.