Answered by
Sheikh Sulaymân al-Tuwayjirî
You should pray with them. When a congregational prayer is held by the people who attend the mosque, you pray with them, even if you are staying in the mosque, so that you do not miss the congregational prayer.
Legally, everyone is excused. Your staying in the mosque for some time does not prevent you from praying with them and benefitting from this legitimate concession.
Allah likes people to benefit from His concessions just as He likes them to obey His commands.
Source: Islam Today


