Living in close quarters, often drunk together, needing to work closely together or for one another in life or death circumstances. Needing to bluntly evaluate ability or judgement and sharing the same. I can see not allowing officers to duel.
Example at the higher rank level: Decatur was a very good American navy officer and leader. He served on the court martial of Barron, and correctly convicted him for being a dufass and surrendering after only one shot against the British back in the bad old days of 1807. Barron was suspended for 5 years. Came back on duty, even though Decatur spoke against it--correctly, as a senior officer.
Years after the court martial Barron calls him out and kills him. Other officers learn it isn't about being a good officer, or duty, it's about being lucky in a duel.