Can i’tikaaf be done at any time or is it only to be done in Ramadaan?.
I’tikaaf is Sunnah at any time, in Ramadaan or otherwise, but it is better in Ramadaan, especially in the last ten days of Ramadaan.
This is indicated by the general meaning of the evidence which speaks of i'tikaaf being mustahabb, which includes Ramadaan and other times. See question no. (48999).
Al-Nawawi said in al-Majmoo’ (6/501):
I’tikaaf is Sunnah according to consensus, and it is not obligatory unless one vowed to do it – also according to consensus. It is mustahabb to do it a great deal and it is mustahabb especially in the last ten days of Ramadaan.
He also said (6/514):
The best i’tikaaf is that which is accompanied by fasting, and the best of that is in Ramadaan, and the best of that is the last ten days.
Al-Albaani said in Qiyaam Ramadaan:
I'tikaaf is Sunnah in Ramadaan and at other times of the year. The basis for that is the verse in which Allaah says (interpretation of the meaning):
“…while you are in I‘tikaaf (i.e. confining oneself in a mosque for prayers and invocations leaving the worldly activities) in the mosques”
And there are saheeh ahaadeeth which describe the Prophet (peace and blessings of Allaah be upon him) observing i’tikaaf as well as numerous reports which describe the salaf as doing so too.
It was proven that the Prophet (peace and blessings of Allaah be upon him) observed i’tikaaf during ten days of Shawwaal as well. This is agreed upon.
‘Umar said to the Prophet (peace and blessings of Allaah be upon him): “During the Jaahiliyyah I vowed to observe i’tikaaf for one night in al-Masjid al-Haraam.” He said: “Fulfil your vow.” So he [‘Umar] observed i’tikaaf for one night. Agreed upon.
It is more emphasized in Ramadaan, because of the hadeeth of Abu Hurayrah: The Messenger of Allaah (peace and blessings of Allaah be upon him) used to observe i’tikaaf for ten days every Ramadaan, and in the year in which he passed away he observed i’tikaaf for twenty days. Narrated by al-Bukhaari.
The best i’tikaaf is at the end of Ramadaan, because the Prophet (peace and blessings of Allaah be upon him) used to observe i’tikaaf for the last ten days of Ramadaan until he passed away. Agreed upon.
Shaykh Ibn Baaz said in Majmoo’ al-Fataawa (15/437):
Undoubtedly i’tikaaf in the mosque is an act of worship, and (observing it) in Ramadaan is better than at other times. It is prescribed in Ramadaan and at other times.
See Fiqh al-I’tikaaf by Dr Khaalid al-Mushayqih, p. 41.