First of all, I imagine a large part of music's role was simply keeping time for marching. Marching in perfect time, with everyone's foot hitting the ground at the same time, asserts discipline and order.
Secondly, walking (marching) is monotonous. Soldiers don't walk as much any more. When they were walking for hours on end, hungry and tired, minds wandering, feet sore, music kept them awake and lively. This is probably a large part of what "boosting morale" is - not necessarily building team spirit or encouraging anyone - simply keeping them awake and moving, giving them something to focus on, and just putting a little bit of jollity into a shitty situation.
Thirdly, there probably was a much stronger emotional response back then because wars actually meant something as opposed to the purely political fights we have nowadays. If you're fighting for your country's rights or independence or for a cause you truly believe in, a little tune written about it can keep that cause in the back of your mind. When you're in danger of death, or you're hungry and tired, or you just feel like you want to totally give up, that music makes you remember that you're fighting for something important and don't really WANT to give up.