The story
Unknown. In the US, it is commonly accepted as a reference to the action of William B. Travis, who, in 1836, while commanding the defenders of the Alamo and contemplating a demand for surrender, drew a line in the sand and asked those willing to remain and defend the Alamo to their deaths to step across.
Etymology from Wiktionary, CC BY-SA 4.0.