Hasan told the judge, Col. Gregory Gross, last week his Muslim faith requires him not to shave.
"Your honor, in the name of almighty Allah, I am a Muslim. I believe that my religion requires me to wear a beard," he said during a hearing on whether he should be held in contempt of court.
Hasan said he was not "trying to disrupt the proceedings or the decorum of the court" but Gross said at the time Hasan was in contempt of court for not shaving his beard in line with Army regulations.
Fort Hood spokesman Tyler Broadway said Gross -- who has threatened to have Hasan forcibly shaved to ensure "a military trial proceeds without a distracting and disruptive sideshow" -- issued an order Thursday that Hasan be shaved, CNN reported.
Prosecutors said allowing Hasan to go to trial with facial hair "injects potential error" into the trial and would "further inflame the [military court] panel to his own detriment."
Hasan is being court-martialed on charges of killing 13 people and wounding 32 others when he opened fire at Fort Hood's processing center in November 2009.
Boston schools pull out free condoms over wrapping complaints
Millions of Getty images now available for free via embed tool