His statement: “He should not visit the sick or attend a funeral, unless he stipulates it”: this is the second category of the person observing i‘tikaf leaving his place of retreat—namely, leaving for a legislated purpose that he can do without.
Examples include visiting the sick and attending a funeral. He can do without visiting the sick because it is a sunnah that a person may forgo without sin; the same applies to attending a funeral. But if, for example, it became obligatory for him to attend a funeral because no one else could be found to wash the deceased or carry the bier to the cemetery, then this would fall under matters that he cannot do without.
His statement, “unless he stipulates it,” indicates that it is permissible to stipulate this at the outset of i‘tikaf. Thus, when he intends to begin i‘tikaf, he may say: “O Lord, I make an exception for visiting the sick or attending a funeral.”
However, this should not be done; preserving one’s i‘tikaf is preferable—unless the sick person, or someone whose death is anticipated, has a right over him. In that case, making such a stipulation is preferable. For instance, if the sick person is among his relatives whose not being visited would be regarded as severing family ties, then he should make this exception; the same applies to attending a funeral.
If someone were to ask: What evidence proves the permissibility of making such a stipulation, given that the basic principle is that once a person begins an act of worship, he must complete it, either obligatorily or recommendedly, according to the ruling of that act of worship?
The answer is that there is no clear evidence on this matter except analogy with the hadith of Dubā‘ah bint al-Zubayr ibn ‘Abd al-Muṭṭalib, may Allah be pleased with her. She came to the Messenger of Allah, may Allah’s peace and blessings be upon him, and told him that she wished to perform Hajj but was ill. He said to her: “Perform Hajj, and stipulate: ‘My place of release is wherever You prevent me from continuing,’ for you have—”