It’s something you learn from your first day of in-processing. Hurry up and wait is the order of the day and what better way to pass the “wait” than dozing off?
The next contributing factor is that troops are generally sleep deprived and have their sleep cycles interrupted constantly. Starting in basic training, a drill sergeant could wake everyone up at 0100 for sh*ts and giggles, have a special someone pull fire guard at 0300, and wake up for the rest of the day at 0500.
Read more: How troops learn to sleep anywhere, any how, any way