Reference: Fataawa al-Lajnah ad-Daa.imah lil-Buhooth al-‘Ilmiyyah wal-Iftaa. – Fatwa No.1640
Question: A man who shaves off his beard is the khateeb in the central masjid. Do you advise we pray behind him? Please explain.
Response: All Praise is for Allaah the One, and prayers and salutations upon His Messenger, upon his family and his companions. To proceed…
Trimming off the beard is haraam for that which has been transmitted by Ahmad, al-Bukhaaree and Muslim on the authority of Ibn ‘Umar (radhi-yAllaahu ‘anhumaa) that the Prophet ﷺ said:
«Differ from the mushrikoon and leave the beards [to grow] and trim the moustaches».
Also, that which has been transmitted by Ahmad and Muslim on the authority of Abu Hurayrah (radhi-yAllaahu ‘anhu) that the Prophet ﷺ said:
«Trim the moustaches and leave the beards [to grow] and oppose (differ) from the magians».
So, to insist on shaving off the beard is from amongst the major sins, therefore it is obligatory that we advise the one who shaves off his beard and admonish him for it.
So based upon this, if he is an imaam of a masjid and does not take the advice, then it is obligatory to replace him if possible providing it does not cause any major fitnah. Otherwise, it is obligatory to pray behind other than him, from those who are noble, if this is possible for them. This is so as to rebuke and admonish him, so long as this too does not create any major fitnah. If this is not possible then it is legislated to pray behind him for the benefit of the congregation and if one fears any fitnah by praying behind other then him. He should then pray behind him and prevent any fitnah by selecting the lesser of the two evils.
And with Allaah lies all success and may Allaah send prayers and salutations upon our Prophet ﷺ and his family and his companions.