
It should be noted that it is Sunnah Muakkadah to keep the rows straight in prayer and to avoid keeping any distance, so in normal circumstances where there is no compulsion to do otherwise, it is makrooh to intentionally leave gaps in the rows.
The same ruling applies in present circumstances, it is not advisable to leave gaps in the row merely because of the illusion of the disease, but if there is an actual outbreak situation at a given place, then in such case the specfic situation should be communicated to religious scholars to obtain the ruling based on that particular situation.
However, if there is a compulsion and it is not possible to practice this Sunnah (as mentioned in the question), then prayer will be acceptable in the mosque, and because doing so is due to a compulsion therefore there won't be even the sin of doing makrooh act.
۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔۔
References
لما فی اعلاء السنن:
"قلت: والظاہر من کلام أصحابنا أنہا سنۃ مؤکدۃ لإطلاقہم الکراہۃ علی ضدہا".
(اعلاء السنن، کتاب الصلاۃ، باب سنیۃ تسویۃ الصف ورصہا، ط: کراچی: ۴ /۳۱۵)
و فی عمدۃ القاری:
"الأمر بتسویۃ الصفوف وہی سنۃ الصلوۃ عند أبي حنیفۃ،ؒ والشافعيؒ، ومالکؒ".
(عمدۃ القاري، ط: بیروت: ۵ /۲۵۴)
وفی أوجز المسالک:
"إن تعدیل الصفوف من سنۃ الصلوۃ ولیس بشرط في صحتہا عند الأئمۃ الثلاثۃ الخ".
(اوجز المسالک، العمل في غسل الجمعۃ، تسویۃ الصفوف قدیم۱/۳۴۱جدید دمشق ۳/۲۹۵)
وفی الشامیۃ:
"کرہ کقیامہ في صف خلف صف فیہ فرجة، قلت: وبالکراہة أیضا صرّح الشافعیة ․․․․․ ولو وجد فرجة في الأوّل لا الثاني لہ خرق الثاني لتقصیرہم".
وقال ابن عابدین:
"أن الکلام فیما إذا شرعوا، وفي القنیة: قام في آخر صف وبین الصّفوف مواضع خالیہ فللدّاخل أن یمرّ بین یدیہ لیصل الصّفوف".
(الدر المختار مع رد المحتار: کتاب الصلاة، باب الإمامة)
Allah knows best
Darulifta Alikhlas, karachi