Just to add on to the above answer, the loyalty of soldiers is a current idea presented in Macbeth. This idea also mixes with the idea of illusion, seeming, appearance versus reality. Macbeth and Banquo appear to be loyal to Duncan at the beginning of the play, but only Banquo really is. Macbeth is destined to betray Duncan, just as Cawdor did, even though he, too, once appeared to be loyal. Macbeth appears later to be loyal to Banquo, even as he is planning to kill both Banquo and his son. Macbeth's army suffers mass desertions in Act V to the point that he no longer has enough men to take on the invading army face to face. Even the soldiers that remain in Macbeth's army purposely miss the enemy when it actually is time to fight.
One could also connect this idea with tyrannicide in the play.
This is quite a complex question. The most obvious soldier in the play is Macbeth himself as in the role of a feudal retainer. Banquo, Malcolm and Macduff are other examples of soldiers in the play. The role of the soldier and its underlying politics is what makes the issue complicated. We see the soldier in Macbeth and Banquo most evidently in Act I scene II in the account of the bleeding Sergeant. We are told of their heroic acts but at a very basic level what they do is a kind of violence nevertheless. Since this is violence enveloped by the garb of patriotism and a retention of the state, this is a law-maintaining violence. Then the violent killings of Duncan, Banquo, Lady Macduff and her son directly or indirectly at the hands of Macbeth is violence still! So, how does the ethical position work here? Can we say that there is a relationship between what Macbeth does in the play from Duncan's murder on and his profession of being a soldier? If all this is rather sceptical, one does see a restoration of the heroic cult of the soldier at the end with characters like Siward and his son Young Siward.
Another thing to consider in relation to this theme is the idea of the soldier and the idea of the king and their conjunction in Renaissance political thought for example in someone like Niccolo Machiavelli. Machiavelli's prince must have military skills.