When the Messenger of Allah ﷺ intended to make itikaf, he would pray Fajr and then enter his place of seclusion.She said, "Once he intended to make itikaf during the last ten days of Ramadan, so he ordered his tent to be set up, and it was pitched. When I saw that, I ordered my own tent to be set up, and it was pitched. He also gave permission to others among the wives of the Prophet ﷺ who asked, and their tents were pitched as well.When he prayed Fajr, he looked at the tents and said, 'What is this? Is it righteousness you seek?' He then ordered his tent to be taken down, and it was dismantled. He ordered his wives to take down their tents as well, and they were dismantled. He then postponed the itikaf to the first ten days of Shawwal."
حدثنا عثمان بن أبي شيبة حدثنا أبو معاوية ويعلى بن عبيد عن يحيى بن سعيد عن عمرة
كان رسول الله ﷺ إذا أراد أن يعتكف صلى الفجر ثم دخل معتكفه قالت وإنه أراد مرة أن يعتكف في العشر الأواخر من رمضان قالت فأمر ببنائه فضرب فلما رأيت ذلك أمرت ببنائي فضرب قالت وأمر غيري من أزواج النبي ﷺ ببنائه فضرب فلما صلى الفجر نظر إلى الأبنية فقال ما هذه آلبر تردن قالت فأمر ببنائه فقوض وأمر أزواجه بأبنيتهن فقوضت ثم أخر الاعتكاف إلى العشر الأول يعني من شوال
Muslim narrated it in Itikaf, chapter "When Should One Who Intends to Perform Itikaf Enter His Place of Itikaf," Hadith 1173, from the hadith of Abu Muawiya Dareer. And Bukhari narrated it in Itikaf, chapter "The Itikaf of Women," Hadith 2033, from the hadith of Yahya bin Saeed Ansari, with the same chain.