We know in our own history that music, specifically drummers and fifers, were inspiring to the soldiers and can be somewhat accredited to success against the British in the American Revolution.
Going back a little further in history, the great Ottoman Empire in the 16th Century used to terrify their enemies with music as they invaded.
But to answer your question, yes, military music can be traced back to the Spartans for sure! They went into battle with flutes ...enemies were scared of the sound! LOL
I personally have studied Ancient Egyptian history which is much older and even they had musicians with them on battle excursions.