Not all of the reasons that members of a military unit might do this have to do with Milgram’s experiment. Milgram’s experiment had to do with obedience whereas one major reason soldiers might do this is camaraderie. Soldiers come to feel a very close connection to one another. They can come to feel that their in group (the unit) is the only thing that matters. Those outside the in group, particularly those who are enemies, are much less important and might at times be murdered without remorse if it is for the good of the unit.
However, there are ways in which Milgram’s experiment does pertain to this. Within the military setting, there is a strong emphasis on obedience to one’s superiors. This is inculcated from the start because it is important for keeping soldiers alive. This may lead, however, to the possibility of murder. If soldiers feel that their superiors want and expect them to commit murders, they may feel that it is right and necessary to do so. This is just how many of Milgram’s subjects reacted.