أَخْبَرَنَا أَبُو عَبْدِ اللهِ الْحَافِظُ، وَأَبُو سَعِيدِ بْنُ أَبِي عَمْرٍو قَالَا: ثنا أَبُو الْعَبَّاسِ مُحَمَّدُ بْنُ يَعْقُوبَ، ثنا إِبْرَاهِيمُ بْنُ مَرْزُوقٍ، ثنا يَحْيَى بْنُ حَمَّادٍ، ثنا أَبُو عَوَانَةَ، عَنْ سُلَيْمَانَ، عَنْ مُجَاهِدٍ، عَنِ ابْنِ عَبَّاسٍ، أَنَّ النَّبِيَّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ كَانَ " يُصَلِّي نَحْوَ بَيْتِ الْمَقْدِسِ، وَالْكَعْبَةُ بَيْنَ يَدَيْهِ، وَبَعْدَ مَا تَحَوَّلَ إِلَى الْمَدِينَةِ سِتَّةَ عَشَرَ شَهْرًا، ثُمَّ صَرَفَهُ اللهُ تَعَالَى إِلَى الْكَعْبَةِ ".
It is narrated from Sayyiduna Ibn Abbas (may Allah be pleased with them both) that the Prophet (peace and blessings be upon him) used to pray (in Makkah) facing Bayt al-Maqdis, keeping the Ka'bah between himself and Bayt al-Maqdis. After that, when he (migrated and) came to Madinah, he kept praying facing Bayt al-Maqdis for sixteen months. Then Allah turned him towards the Ka'bah.