Beard=dead guy in a gas mask. As they found out in WW1, and the Iranians found out again in the Iran-Iraq war.
The electric shaver was developed by an Army colonel in Alaska so his guys could stay shaved in subzero weather (no way to heat water) just after WW1, they didn't want to be dead guys if it came down to throwing gas around again.
Beards have a long tradition in armies (including ours), back in the day (1800s and before) in some units, upon joining you HAD to grow a beard/mustache depending on the unit's tradition. But since the 1890/1900s and introduction of chemical warfare, plus the professionalism of the military, shaved=professional look to the US, and various other armies.
Some let their troops grow a bit more than we do (Italian army, for example, lets them grow a goatee/mustache) and still maintain the professional look, but by and large for US troops it's "mustache or nothing".
Some of the black guys get by on a shaving waiver (for that matter, some really fairskinned guys like redheads). My old unit commander (himself black) told them "if you can shape it, you can shave it" since some of the guys didn't have a little stubble, they had a damned beard practically and were shaping them, etc.