It is Ehtiyat that one should stay with the intention to worship Allah by praying formal or informal prayers although prayer is not a condition therein.
The time for this form of worship could be anytime when one is allowed to fast. The best time is the month of Ramadan, especially, the last ten days.
Itikaf offers an immense hidden benefit, which is protection from the effects of excessive socializing. Itikaf also offers protection from the evil consequences of talking and sleeping too much, because a person usually does Itikaf on his own, turning to Allah by praying Qiyamul-Layl (Night prayers), reading Quran, making Dhikr, reciting dua, and so on.
Undoubtedly, a person’s success in freeing himself from excessive socializing, talking and sleeping, will help him to make his heart turn towards Allah, and will protect him from the opposite.
1. Intention as in the rest of the worship acts. It is necessary that the intention be made at the beginning of Itikaf so that the rule, requiring the worship act to be completed with intention, be followed thoroughly from the beginning to the end. The decision made at the beginning of the night to start Itikaf from the beginning of the following day will be open to objection. However, if one decides to start it from the beginning of the night it is not an offense to do so.
One is not allowed to change one's mind from one Itikaf to another of the same qualities or different.
2. Belief in Islam.
3. Freedom from mental illness.
4. Fasting; thus the Itikaf of one who cannot fast for some reason is not valid.
5. Duration; which is three continuous days at least. It could be more but not less than three days.
If it is started from the beginning of a day the two nights in between will be part of the duration. Less than three days is not considered Itikaf.
That it must take place in one of these Mosques: (a) The holy Mosque in Mecca, (b) the holy Mosque of the Prophet in Medina, (c) the Mosque which is assigned for the Friday prayer in any town or city. It is Ehtiyat, however, to complete it in any of the first four Mosques.
The roof and basement of a Mosque is part of the same and it is valid to complete Etikaf in such places of a Mosque.
Permission of the people whose permission are required such as the husband and parents for the wife and children if this will be against the right of the husband or causes trouble to the parents.
6. Completing it in the Mosque where it was started. Thus, going out of the Mosque without an acceptable reason will invalidate the Itikaf, regardless, one knows the rule or is ignorant or has gone out because of forgetfulness, except in the case of an emergency or one being forced or it is because of some need such as using wash room or having Taharat.
If one needs to have Ghusl/bath during the Itikaf and it is possible for him to have it inside the Mosque, and is not allowed to go out unless the reason for Ghusl requires him not to stay inside the Mosque.
Itikaf is originally an optional worship act but it may become obligatory because of a vow etc.
1. Having sex and also according to Ehtiyat kissing or playing with one's wife;
2. According to a necessary Ehtiyat causing a semen discharge,
3. And smelling perfumes for enjoyment; it is not an offense if one cannot enjoy the perfume because of some defect in his smelling ability.
4. Selling or buying in the form of a business deal, according to a necessary Ehtiyat; there is no offense to be occupied with allowable activities as sewing or writing etc., although it is a Mustahab Ehtiyat to avoid them too.
If one needs to buy something for food and there is no one to do the buying for him, it is not an offence for him to do it.
5. Expressing bitterness in talking about worldly or religious matters in order to prove one's ability, not the truth which is one of the best worships.
The contracts of buying or selling during Itikaf invalidate Itikaf, but such contracts will be valid.
If Itikaf is invalidated because of having sex even, during the night, expiation will be due; if it is invalidated by other things, there will be no expiation, although it is a Mustahab Ehtiyat in this case too.
The expiation for invalidating an Itikaf is to set free a slave or if this is not possible, fast for two consecutive months or if this also is not possible, feed sixty poor people.
Imam Mohammed (Rehmatullah Alaihi) states that there is no limit on the minimum period of time. The fatwa is on this later view. Therefore, it is desirable for anyone entering a Masjid to make the niyyah (intention) of Aiteekaaf for the period that he will remain in the Masjid. So while he is in Ibaadah he also gains the reward of Aiteekaaf.
Imam Ibn Qayyim al-Jawziyyah says: "This leads him to feel contented with Allah instead of the people, which prepares him for being at peace with Him alone on the day of loneliness in the grave, when there is no one else to give comfort, nor anyone to grant solace except Him. So this is the greater goal of Itikaf."