Maliks Muwatta Book 19, Hadith Number 8.
Malik was asked whether someone who went into a mosque to do itikaf for the last ten days of Ramadan and stayed there for a day or two but then became ill and left the mosque, had to do itikaf for the number of days that were left from the ten, or not, and if he did have to do so, then what month should he do it in, and he replied, “He should make up whatever he has to do of the itikaf when he recovers, whether in Ramadan or otherwise. I have heard that the Messenger of Allah, may Allah bless him and grant him peace, once wanted to do itikaf in Ramadan, but then came back without having done so, and then when Ramadan had gone, he did itikaf for ten days in Shawwal.
Some one who does itikaf voluntarily in Ramadan and some one who has to do itikaf are in the same position regarding what is halal for them and what is haram. I have not heard that the Messenger of Allah, may Allah bless him and grant him peace, ever did itikaf other than voluntarily.”
Malik said, that if a woman did itikaf and then menstruated during her itikaf, she went back to her house, and, when she was pure again she returned to the mosque, at whatever time it was that she became pure. She then continued her itikaf from where she left off. This was the same situation as with a woman who had to fast two consecutive months, and who menstruated and then became pure. She then continued the fast from where she had left off and did not delay doing so.