There are many stories regarding the origins of the baguette, but all trace back the birth of the iconic French bread to the 1800s.
Some say that Napoleon Bonaparte wanted his soldiers to carry their bread more easily. French bread was traditionally of round shape and was not easily transportable by soldiers during long campaigns. He ordered French bakers to find a solution for him and they came up with long thin bread that could be stored in the soldiers’ pockets along their pants. This might be a nice story, but it is WRONG! Imagine with such a thin crust eating a bread after a full day: a baguette is only fresh for 8-10hours!
The actual origin of the baguette is when the Pain Viennois arrived into France from Austria. In 1839, an Austrian baker arrived in France to open his own bakery and it served this bread made out of yeast, flour and milk. The new bread seduced Parisians but it was expensive since it contained milk and spoiled easily. After the First World War, the baguette, as it is found today, was born when the milk was removed from the recipe.
When building the Parisian metro, workers from all over France were hired. France has strong regional identities and Bretons and Auvergnats were fighting a lot. At the time all workers had a knife with them to cut their bowl of bread at lunch, so not only did they fight but they stabbed each other. The chief engineer, Fulgence Bienvenüe, asked a baker to create bread that has the same weight as a bowl (it was the law) but that could be cut without a knife. Hence the baguette! That's why today some people are reluctant to use a knife to cut a baguette!