Period: 19th century to 20th/21st century
In the early 1800s soldiers/officers having facial hair was prolific. Even until the late 1800s (Franco-Prussian War, Anglo-Zulu War) many still wore large beards and moustaches. However coming in to WW1 and all the conflicts past that, the standard (bar places like the Indian Army) was to be clean shaven. Today, absolutely no facial hair is allowed in most armies as part of the uniform instructions.
What saw this change?
I'm not sure why Beards seems to popular, but you might be interested in this other thread from today. Not quite the same thing, but similar!