Praise be to Allah.
Shaving off the beard is haraam, because of the saheeh hadeeths that clearly enjoin letting it grow. See the answer to question no. 1189.
Based on that, it is not permissible to work in a place in which you will be instructed to commit this sin.
Shaykh Ibn Baaz (may Allah have mercy on him) was asked: I am in the army and I always shave my beard, against my will. Is that haraam or not?
He replied: It is not permissible to shave off the beard, because the Messenger of Allah (blessings and peace of Allah be upon him) enjoined leaving it alone and letting it grow, in saheeh hadeeths. And he (blessings and peace of Allah be upon him) said that by letting it grow, one is differing from the Magians and mushrikeen, and he (blessings and peace of Allah be upon him) had a thick beard. Obeying the Messenger is obligatory for us, and following his example in his attitudes and actions is one of the best of deeds, because Allah, may He be exalted, says (interpretation of the meaning):
Indeed in the Messenger of Allah (Muhammad SAW) you have a good example
And whatsoever the Messenger (Muhammad SAW) gives you, take it, and whatsoever he forbids you, abstain (from it)
And let those who oppose the Messengers (Muhammad SAW) commandment (i.e. his Sunnah legal ways, orders, acts of worship, statements, etc.) (among the sects) beware, lest some Fitnah (disbelief, trials, afflictions, earthquakes, killing, overpowered by a tyrant, etc.) befall them or a painful torment be inflicted on them
Imitating the kuffaar is one of the gravest of evil actions and one of the causes of being gathered with them on the Day of Resurrection, because the Prophet (blessings and peace of Allah be upon him) said: Whoever imitates a people is one of them. If you are in a job where you are required to shave off your beard, then do not obey them in that regard, because the Messenger (blessings and peace of Allah be upon him) said: There is no obedience to any created being if it involves disobedience towards the Creator. If they force you to shave it off, then leave that job which is making you do something that angers Allah. Many other means of earning a living are available, praise be to Allah, and whoever gives up a thing for the sake of Allah, Allah will compensate him with something better than it.
May Allah help you and make things easy for you, and may He make us and you steadfast in adhering to His religion.
End quote from Majmoo Fataawa Ibn Baaz, 8/376.
It says in Fataawa al-Lajnah ad-Daa'imah, 12/20: Question: Please tell me the ruling on one who works in the army (of a Muslim country) and this is his source of income, but the military rules require him to shave his beard, and we have to go to extremes in honouring one another, and when we meet we have to salute one another in a way that is not as Allah and His Messenger commanded us to do, and to honour the country's flag, and to refer for judgement amongst us to a law that is not the law of Allah (i.e., military law). If I fight to defend the country, that is not under the banner of La ilaaha ill-Allah Muhammad rasool-Allah, and Allah wills that I should be killed, what is the ruling according to the Qur'an and Sunnah? Is it possible for me to fight with an intention other than that of the army in whose ranks I am fighting? If I do the above to ward off some harm that may befall me (if I do not do it), am I sinning thereby? Is it possible for a Muslim to work in the army with the intention of learning fighting skills that he cannot learn in any other way under current circumstances?
Please advise me about obeying my parents in this matter, if our points of view differ, and my parents do not want to refer to the Qur'an or Sunnah, but to the customs of society and what people are agreed on, and they think that religion is no more than prayer and fasting and so on, and anything other than that is extremism. May Allah enable you to do that which pleases Him, and guide you and protect you.
Firstly: It is haraam to shave the beard, and it is obligatory to let it grow.
Secondly: it is not permissible to salute the flag.
Thirdly: it is obligatory to rule in accordance with Islamic shareeah and to refer to it for judgement. It is not permissible for a Muslim to salutes his colleagues or superiors in the manner of non-Muslims, because of the reports which indicate that it is haraam to imitate them, and because that is showing excessive respect towards them.
Fourthly: The one who fights to make the word of Allah supreme and to defend the Muslims and to protect Muslim land against the enemy, then this is for the sake of Allah, and if he is killed he will be a martyr, because what matters is intentions. And you can form an intention that is different from the intention of the army, such as if you intend to make the word of Allah supreme by means of your jihad, even if others have a different intention, such as fighting for their country.
Fifthly: obeying your parents is obligatory so long as it does not involve disobedience towards Allah, for there is no obedience to any created being if it involves disobedience towards the Creator. End quote.
And Allah knows best.
Reproduced from Islam QA