Maliks Muwatta Book 19, Hadith Number 4.

Section : Things Without Which Itikaf is Not Possible.

Yahya related to me from Malik that he had heard that al-Qasim ibn Muhammad and Nafi, the mawla of Abdullah ibn Umar said, “You cannot do itikaf unless you are fasting, because of what Allah, the Blessed and Exalted, says in His Book, ‘And eat and drink until the white thread becomes clear to you from the black thread of dawn, then complete the fast until night-time, and do not have intercourse with them while you are doing itikaf in mosques,’ (Sura 2 ayat 187). Allah only mentions itikaf together with fasting.”

Malik said, “That is what we go by here.”