Ayesha reported,

Aisha said, "I would enter the house for some need even when there was a sick person inside, and I would only inquire about him as I passed by. The Messenger of Allah ﷺ used to lean his head in to me while he was in the mosque, and I would comb his hair. He would not enter the house except for a necessity when he was in itikaf."

Azami 4708

Sahih

عن عائشة زوج النبي ﷺ

قالت: إن كنت لأدخل البيت للحاجة والمريض فيه، فما أسأل عنه إلا وأنا مارة وإن كان رسول الله ﷺ ليدخل علي رأسه وهو في المسجد فأرجله، وكان لا يدخل البيت إلا لحاجة إذا كان معتكفا.

الأعظمي 4708صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Fasting
Chapter
Itikaf
Section
Exiting of the mutakif from the masjid to fulfill his needs, not for other matters like visiting the sick, following the funeral, and similar things
Numbering
Jami al-Kamil 4708 (2nd edition)
Azami 4708