The space between each pair of deck planks in a wooden ship was filled with a packing material called "oakum" and then sealed with a mixture of pitch and tar. The result, from afar, was a series of parallel lines a half-foot or so apart, running the length of the deck. Once a week, as a rule, usually on Sunday, a warship's crew was ordered to fall in at quarters -- that is, each group of men into which the crew was divided would line up in formation in a given area of the deck. To insure a neat alignment of each row, the Sailors were directed to stand with their toes just touching a particular seam. Another use for these seams was punitive. The youngsters in a ship, be they ship's boys or student officers, might be required to stand with their toes just touching a designated seam for a length of time as punishment for some minor infraction of discipline, such as talking or fidgeting at the wrong time. A tough captain might require the offender to stand there, not talking to anyone, in fair weather or foul, for hours at a time. Hopefully, he would learn it was easier and more pleasant to conduct himself in the required manner rather than suffer the punishment. From these two uses of deck seams comes our cautionary word to rowdy youngsters to "toe the line."
I too go with the chief on the Naval connotations of the term. The below is from an old pamphlet recounting terms and traditions of the Royal Navy. This below practice was from the 18th & 19th century.
"It is owing to the nefarious practices on the part of the Purser that the system came into force which is still with us of Mustering by the Open List, when every man personally reports who he is and what he is paid for. This ceremony is called Mustering by the Ledger, or in lower deck slang White Line Day, from the fact that every man Toes the Line as he recounts the duties for which he draws pay. The ceremony is generally carried out quarterly and at Inspections."