Answer
First: Intention: The intended worship is not valid without intention. The Prophet (peace be upon him) said: "Actions are judged by intentions." Refer to: Bada'i' al-Sana'i' 2: 109, and Al-Hidayah al-'Aliyyah p. 183. Second: Islam: The disbeliever is not among the people of worship. Refer to: Bada'i' al-Sana'i' 2: 108, and Al-Hidayah al-'Aliyyah p. 57. Third: Sanity: I'tikaf (spiritual retreat) is not valid for the insane; because worship can only be performed with intention, and they are not among those capable of intention. Refer to: Al-Hidayah al-'Aliyyah p. 57, and Bada'i' 2: 108. Fourth: Purity from major impurity, menstruation, and postpartum bleeding: The person in a state of major impurity, menstruation, or postpartum bleeding is prohibited from entering the mosque; as the Prophet (peace be upon him) said: "I do not permit the mosque for a menstruating woman or a person in a state of major impurity," in Sahih Ibn Khuzaymah 2: 284, and Sunan al-Bayhaqi al-Kabir 2: 442, and Sunan Abu Dawood 1: 60, and Musnad Ishaq ibn Rahawayh 3: 1032. This worship can only be performed in the mosque. Therefore, if a woman vowed to perform i'tikaf for a month and menstruated during it, she must leave the mosque and make up her days of menstruation and connect them to the month so that the continuity is not broken. If she does not connect them, she must start anew; because this amount of continuity is within her capacity, and what is excused from her is known to be beyond her capacity. However, if she vowed to perform i'tikaf for ten days and menstruated during it, she must start anew. Refer to: Al-Mabsut 3: 121. As for irregular bleeding (istihadah), it does not prevent i'tikaf; as Aisha (may Allah be pleased with her) said: "A woman from the wives of the Prophet (peace be upon him) performed i'tikaf while she was experiencing istihadah, and she would see the redness and yellowness, and sometimes we would place a basin under her while she prayed," in Sahih al-Bukhari 2: 716, and Sunan al-Bayhaqi al-Kabir 1: 328, and refer to: Bada'i' al-Sana'i' 2: 108, and I'tikaf: Its Rulings and Importance p. 57. Fifth: The mosque: It is a condition that i'tikaf be performed in a congregational mosque or a main mosque for men, or the mosque of the house for women; as Allah, the Exalted, said: "And do not approach them while you are in i'tikaf in the mosques" (Al-Baqarah: 187). He described them as being in i'tikaf in the mosques while they did not engage in sexual relations in the mosques; to prohibit sexual relations therein, indicating that the place of i'tikaf is the mosque. Aisha (may Allah be pleased with her) said: "The Sunnah for the one in i'tikaf is that he does not visit the sick, nor attend funerals, nor touch a woman, nor engage with her, nor leave for a need except for what is absolutely necessary, and there is no i'tikaf except with fasting, and there is no i'tikaf except in a main mosque," in Sunan Abu Dawood 2: 333, and Sunan al-Bayhaqi al-Kabir 4: 321, and Musannaf Abdul Razzaq 3: 168. The obligatory and voluntary i'tikaf are equal in this regard because the text is general. Refer to: Bada'i' al-Sana'i' 2: 113. Sixth: Fasting: It is a condition for the validity of obligatory i'tikaf only; as Aisha (may Allah be pleased with her) said: "The Sunnah for the one in i'tikaf is that he does not visit the sick, nor attend funerals, nor touch a woman, nor engage with her, nor leave for a need except for what is absolutely necessary, and there is no i'tikaf except with fasting, and there is no i'tikaf except in a main mosque," in Sunan Abu Dawood 2: 333, and Sunan al-Bayhaqi al-Kabir 4: 321, and Musannaf Abdul Razzaq 3: 168. This is not known except through hearing, and it has not been narrated that the Prophet (peace be upon him) performed i'tikaf without fasting; if it were permissible, he would have done it to teach its permissibility. Aisha (may Allah be pleased with her) said: The Prophet (peace be upon him) said: "There is no i'tikaf except with fasting," in Al-Mustadrak 1: 606. Al-Tahanawi said in I'la al-Sunan 9: 177: Its chain is authentic according to the principle of Al-Suyuti mentioned in the sermon of Kanz al-'Umal, and Al-Suyuti authenticated it in Al-Jami' al-Saghir. And Al-Qasim ibn Muhammad and Nafi' Mawla Ibn Umar (may Allah be pleased with them) said: There is no i'tikaf except with fasting. Allah, the Exalted, says in His Book: "And eat and drink until the white thread of dawn becomes distinct to you from the black thread. Then complete the fast until the night, and do not approach them while you are in i'tikaf in the mosques" (Al-Baqarah: 187). Thus, Allah mentioned i'tikaf with fasting. And if he vowed to perform i'tikaf while fasting, he is obligated to perform i'tikaf while fasting; and if it were not a condition, he would not be obligated, just as if he vowed to perform i'tikaf while giving charity of ten dirhams; this is because a vow is not valid unless it is of its kind, obligatory, and intended; for the servant cannot establish causes nor legislate rulings, rather he must impose upon himself what Allah has imposed upon him, and Allah has not made it obligatory to remain alone except within the context of worship, like sitting in the Tashahhud. And because fasting is the abstention from eating, drinking, and sexual relations, and one of the pillars of fasting is the abstention from sexual relations, which is a condition for the validity of i'tikaf, so likewise the other pillar, which is the abstention from eating and drinking, is a condition for the validity of i'tikaf, since both are equal in being pillars of fasting. If one of the two pillars is a condition, then the other is likewise. Refer to: Al-Tabeen 1: 348, and Bada'i' al-Sana'i' 2: 109, and Al-Mabsut 3: 116.