The reason that people start to walk like each other and synchronize their steps is that they have a subconscious need to show their companion that they agree with them and so fit in with them.
This is also a signal to other people that “we are together, we are synchronized”.
Other studies suggest that we adopt the mannerisms of our companions as well, especially our superiors, such as crossing our legs in the same directions as others.
An example often given is when, in a meeting, the boss scratches his nose and others at the table then follow him without realising it.
While it is purely unsubstantiated opinion, we do have an answer to why people tend to synchronise their steps.
When observing a group of children walking in a park, supervised by two adults, it was noted that the adults synchronized their steps and direction, while the children walked, ran and skipped apparently at random, running ahead, lagging behind, and deviating from the common course.
Perhaps these children, unpolluted by society’s emphasis on conformity, have not yet learned that it is unacceptable to march to your own drum.
The next time you walk alongside somebody, walk out of step.
Then try to follow the conversation you are having. You will soon fall back into step, because once you are in step with the other person, it is easier to watch where you are walking and then turn to look at them.
Communication is easier with another person when you are in close proximity and when both faces are relatively stable and not bobbing all over the place.
Here is a more prosaic, or less sociologically inclined explanation.
When people walk they have a slight side-to-side sway.
Two people walking together and out of step would bump shoulders every second step.