All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The prayer should not be abandoned in the mosque simply because wearing a mask is uncomfortable unless the worshipper gets harmed by it to the extent that he is distracted from the Prayer because of it; in which case, he may abandon the congregation in the mosque and this situation is of two cases:
Firstly, it is stipulated in the Sharee’ah that it is disliked to start the Prayer while there is something that prevents its perfection and prevents observing Khushoo’ (proper focus and humility) in Prayer, as in the case of the person who restrains urine [i.e. while having a strong urge to urinate] and the one who is presented with food. The jurists stated that what prevents the perfection of Prayer and observing Khushoo’ in it, takes the same ruling as the person who restrains urine and the one who is presented with food.
Kash-Shaaf al-Qinaa’ reads:
“It is disliked to start it, i.e. the Prayer, while one is suppressing his urine [i.e. while having a strong urge to urinate] or feces, or to start it while holding back wind, and the like of what is mentioned of what disturbs him and distracts him from observing Khushoo‘ in Prayer, or starting it while one desires food, or drink, or to have sexual intercourse with one’s wife, as ‘Aa’ishah narrated that the Prophet said: “No Prayer should be performed when the food has been served, nor should it be performed when a person is resisting the urge to relieve himself of the two filths (i.e. urine and feces).” [Muslim] The same thing applies to what is in the same meaning of what has been mentioned, and the like...even if he misses the congregational Prayer.” [End of quote]
This means that he does not pray in that state until he removes anything that distracts him from the Prayer, even if he misses the congregational Prayer.
Secondly, if the matter conflicts between praying in the mosque with a mask while one is distracted and praying at home without a mask while observing the Khoshoo’, then he prays at home and does not pray in the mosque, as the jurists mentioned that realizing the virtue related to the very act of worship is more important than the virtue related to its location; Imam Az-Zarkashi said in al-Manthoor fi al-Qawaa'id al-Fiqhiyyah: “The virtue related to the very act of worship is more important than the virtue related to its place [i.e. the place where it is performed].”
If one prays at his home in this case, he should make sure to perform it in congregation with the family so that he does not miss the reward of praying in congregation. Indeed, many scholars who are of the view that the Prayer must be performed in congregation, they do not restrict the obligation to the mosque; rather, the obligation of congregation is fulfilled at any place.
Allah knows best.