Question: Is it permissible for the one in a state of i’tikaaf to leave the Haram (i.e. al-Masjid al-Haraam in Makkah or al-Masjid an-Nabawee in Madeenah) to go and eat or drink? And is it permissible for him to ascend to the roof of the masjid to listen to the lectures?
Response: Yes, It is permissible for one in the state of i’tikaaf in al-Masjid al-Haraam (in Makkah) or other than it, to leave (the masjid) to go to eat or drink if he is unable to bring these (supplies) to the masjid. This is because this is something which is necessary, just as he would need to leave to answer the call of nature and, likewise, he would have to leave to perform ghusl if he is in the state of janaabah (as in the case of the one who has a wet dream).
As regards ascending to the roof of the masjid, then even this does not affect (his i’tikaaf) because leaving the masjid from any of the (exit) doors, intending by it to return to the masjid by proceeding to the roof are only a matter of a few steps. (So) there is no harm in this.
Shaykh Ibn ‘Uthaymeen
Fataawa Ramadhaan – Volume 2, Page 879, Fatwa No.867
al- Fataawa libni-‘Uthaymeen – Kitaab -ad’Da’wah – Volume 1, Pages 205-206.fatwaonline.com