It's military, from when units lined up in a formation.
From antiquity to the American Civil War formations were used to increase combat power and ease the handling and direction of large numbers of troops. Keeping your place in the formation during maneuvers who's the mark of a good soldier.
It's only a short jump to use the phrase to mean obedience and conformity.
Incidentally it's "toe the line" not "tow the line" not sure of the etymology but it may be I'll disappear down that rabbit hole later
It's military, from when units lined up in a formation.
From antiquity to the American Civil War formations were used to increase combat power and ease the handling and direction of large numbers of troops. Keeping your place in the formation during maneuvers who's the mark of a good soldier.
It's only a short jump to use the phrase to mean obedience and conformity.