I started wondering this after last night's Game of Thrones episode, in which there was a brief scene where the Lannister armies are marching through the countryside in lockstep, like a marching band, with a rehearsed stepping pattern.
Was this just for displays of discipline when passing through cities, or did medieval armies actually march that way over long distances? I would have imagined they just walked like normal...
Standard disclaimer: GoT is a fantasy series and, despite certain similarities to medieval Europe, one should not assume that anything in it is historically accurate.
Armies in general did not and do not march long distances in step. It's not practical or useful in that context. Soldiers just need to maintain their intervals and place in the line of march. Among armies that have practiced elaborate close order drill, it's usually for tactical purposes. A unit can maneuver better on the battlefield if their movements are synchronized and their response to orders is instantaneous.
I have seen nothing that would indicate medieval armies marched in step, on or off the battlefield, until perhaps the very end of the period; I'm a little fuzzy on the Swiss. It's possible this is just a weakness of our source materials, but I doubt it. Medieval armies were not permanent, standing forces, as in Rome or as would later be the case in early modern Europe. Rather, they were assembled as and when needed from the fighting men available, then disbanded when the campaign was over. Members of small units (<100 men) would likely be used to working with each other, but they would probably not be nearly as comfortable operating as part of a larger whole. This made medieval armies a bit less maneuverable and coordinated, though this should not be taken to imply that they were composed of poor or inexperienced soldiers.