The Messenger of Allah ﷺ entered the Kaabah along with Usama, Bilal, and Uthman bin Talha al-Hajabi, and the door was closed behind them. He remained inside for some time.Ibn Umar said, "When Bilal came out, I asked him, 'What did the Messenger of Allah ﷺ do inside?'"Bilal replied, "He stood with two pillars on his left, one pillar on his right, and three pillars behind him. The House at that time stood on six pillars. Then he prayed."
أن رسول الله ﷺ دخل الكعبة، هو وأسامة وبلال وعثمان بن طلحة الحجبي فأغلقها عليه. ثم مكث فيها. قال ابن عمر: فسألت بلالا حين خرج: ما صنع رسول الله ﷺ؟ قال: جعل عمودين عن يساره وعمودا عن يمينه وثلاثة أعمدة وراءه. وكان البيت يومئذ على ستة أعمدة، ثم صلى.
Malik related it in Hajj (193) from Nafi, from Ibn Umar, as mentioned. Bukhari related it in Prayer (505) from Abdullah bin Yusuf, and Muslim related it in Hajj (1329) from Yahya bin Yahya Tamimi, both of them from Malik with the same wording.The two sheikhs (Bukhari and Muslim) related it through Layth, from Ibn Shihab, from Salim, from his father, who said, "When they opened it, I was among the first to enter. I met Bilal and asked him, 'Did the Messenger of Allah ﷺ pray in it?' He said, 'Yes, he prayed between the two Yemeni pillars.'"Ayub also related it from Nafi, from Ibn Umar, who said, "I forgot to ask him how many units he prayed."There is also a hadith on this subject from Ayesha, though it has not been established as sound. See its sourcing in Minna Kubra (4/346).