This happened when I was in the Army stationed overseas.
In due course I pulled CQ runner duty one night. Each E-5 in our unit had to serve as CQ ('charge of quarters'), and each E-4 and below had to serve as CQ runner. (E-5 is an enlisted rank equivalent to buck sergeant.) The duty was just for one night and came around in rotation about once every nine or ten months.
The CQ's job was to sit all night at the desk in the orderly room (the company office) and take charge when something needed to be done after hours. The CQ runner's job was to go on errands for the CQ when the need arose. A cot was set up in an office off the orderly room (the CO's or the XO's, I forget which; in fact, I can't even remember whether the XO had an individual office of his own or whether he sat at a desk in the orderly room all day), so that the CQ runner could catch some sleep when not off on an errand. The CQ, however, had to stay awake by the telephone all night.
The night I pulled CQ runner, a call came in to the CQ around midnight that a certain soldier was to report to the communications center immediately to help fix some malfunctioning equipment. Off I went to deliver the message.
I should mention that we lived in barracks with separate rooms, not in open bay barracks. There were supposed to be three or four men to a room, depending on rank, and each room was equipped with two double-decker bunk beds or a double-decker bunk bed and a single bunk, but we were short-staffed. Instead of closing some rooms off and compressing us all into rooms with the prescribed number of men, they let us sleep two or three men to a room.
The guy I was sent after and his roommate (they shared a two-man room) were good friends of mine. When I got to their room, I knocked but I didn't feel it was necessary to wait for an answer, especially since I expected them to be asleep, I just opened the door, which for some reason was unlocked, and walked in.
The light in the room was out, but the light from the hallway revealed a sight that made my jaw drop. There on the bunk were my friends lying face to face. They were buck naked. They were clenching each other's dicks in their fists and they were masturbating one another like crazy.
They were so wrapped up in what they were doing it took them a moment or two to realise that I was standing in the doorway. When they did, they disengaged from one another and sat bolt upright. Their dicks went slack and shriveled up. For an instant we stared at each other without saying a word. Then I closed the door behind me in case anyone happened to pass by in the hallway, and turned on the light.
First I assured them I was completely cool with what I had seen, and I swore I would never tell anyone. (If I had reported them, they would have been in deep trouble, of course, and even if word just got around among the guys, their lives could have been pretty unbearable.) Then I delivered my message and left as the guy I was sent after started pulling on his fatigues.
I walked away from their room with the image of my friends masturbating one another permanently etched in my mind. When I got back to the orderly room, I had a raging hard on that was howling for relief. The CQ had nothing more for me to do, so I went into the office next to the orderly room, pulled off my boots, turned out the light, lay down on the cot, and whacked off into my fatigue pants. I tried to be as quiet as possible because the CQ was sitting in the next room.