When you shave anywhere, the blade does some damage to the skin. It opens thousands of tiny gashes, gouges and cuts. Luckily, these don't cause any serious damage, and they heal quickly. The problems start when you immediately apply a chemical to the area, or the area becomes sweaty. What do you usually do right after you shave your underarms? You probably apply deodorant. And what do your underarms do just about all the time? They sweat.
The chemicals, fragrances and other ingredients in your deodorant or antiperspirant get into those tiny cuts. In fact, anti-perspirants work by plugging up the pores under your arms so you don't sweat, which means they do an excellent job of getting into those tiny cuts. This can really irritate the skin under your arms. Your own sweat can irritate the area, too, because bacteria thrive in that moist, dark environment. They'll thrive there anyway, but if you shave at night, right before bed, you're unlikely to be running around in the hot sun. Less sweat right after shaving means fewer bacteria getting into cuts, which equals less chance of irritation.
By the time morning comes around, your skin will have healed, so antiperspirant and sweat won't do much harm.