shedding more light on this issue, we'd like to cite for you the following fatwa issued by dr. muzammil h. siddiqi, former president of the islamic society of north america:
i`tikaf in the last ten days of ramadan in the masjid (mosque) is a beautiful tradition of the prophet (peace and blessings be upon him). it is like a spiritual retreat. it is reported by `a’ishah (may allah be pleased with her) that the prophet (peace and blessings be upon him) used to observe i`tikaf during the last ten days of the month of ramadan and he continued this practice until his death. after him, his wives carried on this practice of observing i`tikaf regularly. (reported by al-bukhari and muslim)
it is recommended that every muslim make at least one i`tikaf in his/ her life. there must be at least few people in every community who should do it in every masjid every year to keep this tradition alive. men should do i`tikaf in the masjid so that they can pray in jama`ah (congregation) and also offer the friday prayers. women can also do i`tikaf, but theirs must be at home for reasons of modesty and for their own convenience. there is a great blessing in i`tikaf and people who do it bring blessings upon themselves, upon their families, and upon the muslim community at large.
the sunnah of i`tikaf is that one make the intention and begin the i`tikaf on the evening of the 20th of ramadan from sunset time and continue until the sighting of the moon for `edul-fitr. during i`tikaf men should stay in the masjid day and night and should not leave it except for the use of toilet or shower. they are allowed to eat also inside the masjid, but if it is not convenient they may go outside and come back as soon as they finish.
during i`tikaf one should spend most of one’s time in prayer, reading the qur’an, dhikr, and reflection. engaging in business and other worldly conversation and activities is not allowed during i`tikaf. however, attending a janazah (funeral) or visiting a sick person or leaving for any emergency is permissible.