Answering your question, Sheikh Mustafa Umar, President of California Islamic University, states:
Itikaf is to seclude yourself inside a mosque and focus on worshipping Allah without normal distractions of daily life. It is a commendable act to be performed in any mosque and is especially recommended during the last ten nights of Ramadan since that was the regular established practice of the Prophet Muhammad (peace be upon him).
In order for Itikaf to be valid, a person must be fasting, avoid intimacy and intercourse, and not leave the mosque without a good reason such as going to the toilet, acquiring food, or helping someone with an emergency. (See Al-Mawsili, Kitab Al-Ikhtiyar 177-178)
Itikaf is normally only valid for men inside a mosque. However, given the fact that most mosques are closed due to the Coronavirus (COVID-19) pandemic, it would be encouraged for men to seclude themselves (khalwah) in the designated prayer area of their home for as much time as possible. If they had the intention and the means to perform Itikaf in the mosque, but are unable to due to it being closed, it is hoped that from the mercy of Allah they will get the same reward. Since their seclusion will not be technically considered an Itikaf, the normal rules will not apply.
The two instances where Itikaf is mentioned in the Quran are both connected with the mosque. Allah says, “…Purify My House for those who walk round it, those who stay there, and those who bow and prostrate themselves in worship.” (Al-Baqarah 2:125)
Again, He says, “…Do not lie with them during the nights of your devotional retreat in the mosques: these are the bounds set by God, so do not go near them…” (Al-Baqarah 2:187) Furthermore, all the narration from the Prophet Muhammad referring to Itikaf are all connected to being in a mosque. Likewise, the Companions all held the opinion that it must be done in a mosque.
Mainstream Muslim scholars have held the opinion that Itikaf is supposed to be performed inside a mosque. The position of the Hanafi school was explained by Imam Al-Mawsili: “It must be performed in a mosque where prayers are held…since the person in Itikaf awaits the prayer to pray it in a group (jama`ah), so the greater the mosque the greater the reward of Itikaf in it.” (Kitab Al-Ikhtiyar, 177)
The Maliki position was explained by Imam Hattab, “Itikaf is valid in any mosque…but not in a house according to Imam Malik, neither for men or women.” (Mawahib Al-Jalil 3:241)
The position of the Shafi`i school was explained by Imam An-Nawawi: “…it is not valid except in the mosque due to verse 2:187 which indicates that it is only permitted in the mosque.” (Al-Majmu` Sharh Al-Muhadhdhab, 8:6)
The Hanbali position was explained by Imam Ibn Qudamah: “The Itikaf of a man is not valid except in a mosque. We are not aware of any difference of opinion between the scholars on this issue… The fact that Allah Most High specified Itikaf within the mosque is an indication that it should be observed exclusively in the mosque only.” (Al-Mughni 3:189)
The only difference of opinion that has been reported is about women being allowed to perform it at home only in the designated prayer area of her house. This was the position of Imam Abu Hanifah and one opinion attributed to Imam Ash-Shafi`i (though scholars like Imam An-Nawawi consider this to be a weak ascription). Imam As-Sarakhsi explains the reasoning as follows, “When a woman performs Itikaf in the designated prayer-area of her home, then that area for her is similar to what a congregational mosque is for a man.” (Kitab Al-Mabsut, 2:132)
Lastly, the only scholar I could find who ever allowed Itikaf in general outside of a mosque is Ibn Lubabah, but his opinion was deemed to be ‘strange’ (shadh) and therefore cannot be considered as a valid historical precedent. (See Bidayat al-Mujtahid 2:77)
The majority of Muslim scholars have made it clear that Itikaf can only be performed in a mosque. The Hanafi school was one exception where they said that a woman may perform it in her house. While it may be tempting to apply an analogy and say that if women were allowed then men should also be, this idea does not make sense when the rationale behind why women were specifically given this exemption is properly understood.
Therefore, although many mosques are closed, Itikaf should remain associated with a mosque, as it was intended. Furthermore, the practice of Itikaf is not a requirement in Islam, so no individual is missing out. If one or two people are able to perform it, such as the Imam or the Muezzin (Caller to Prayer), that will at least ensure the sanctity of the mosque has been upheld. Others may try to focus on worship and come close to the purpose of Itikaf at home, while hoping for the reward from Allah, even though it is not a complete Itikaf.