Napoleonic armies were very structured and formations and precise orders were essential to keeping up morale. They marched shoulder to shoulder with other soldiers in large formations consisting of several lines of infantry. Since they were packed so tightly, the only real way to run is forward or across your own army's line of fire. So in this sense you'd have to shove through the people behind you, which obviously made running very difficult. Officers would be on horseback and ride along the lines during the battle, encouraging their troops and making sure everyone stayed in formation. If a soldier did run, there would be men in the rear (usually on horseback) who would make the soldier return to formation. There would also be infantry in the back who would fill the gaps if any appeared. Because of this you'd never have an open side, and this served well to keep soldiers in line.
That's sort of the basic idea - if you wanted to run, you're packed shoulder to shoulder with other soldiers, who in turn were also shoulder to shoulder. When you're dealing with the numbers of soldiers in a single formation, it's almost impossible for one man to alter or break through the formation, especially when mounted officers are ensuring everyone is in their place.
Here's a brief read that gives some good information on how the armies worked: https://books.google.ca/books?hl=en&lr=&id=_qajCwAAQBAJ&oi=fnd&pg=PA1&ots=qgzMpCLYUv&sig=8zE9BI_iHb3g5jh1SRVSB-eCNn4#v=onepage&q&f=false