All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Shaving the beard is prohibited according to the opinion of the majority of the scholars, the texts of Sharee‘ah and the guidance of the Prophet, sallallaahu ‘alayhi wa sallam.
This sin becomes graver if it is committed in one of the houses of Allaah, the Exalted, because sin becomes graver if it is committed in a virtuous place like a mosque or a virtuous time like the month of Ramadan.
However, there is no specific expiation for shaving the beard in the mosque, except turning to Allaah in repentance.