“Toe the line” is the same as “toe the mark” and means “follow the rules or pay the consequences.”
In many sports, such as foot racing, the athletes were required to stand with their toes against a scratched line to ensure a fair start.
As punishment in the navy, no matter what the weather, young trainees were forced to stand for hours with their toes touching a seam on the ship’s deck, and this too was toeing the line.