[Machine] The Prophet ﷺ used to pray while he was in Mecca, facing the direction of Al-Masjid Al-Aqsa, with the Kaaba in front of him. After migrating to Medina, he continued praying towards Al-Masjid Al-Aqsa for sixteen months before the direction of prayer was changed towards the Kaaba.
كَانَ رَسُولُ اللهِ ﷺ يُصَلِّي وَهُوَ بِمَكَّةَ نَحْوَ بَيْتِ الْمَقْدِسِ وَالْكَعْبَةُ بَيْنَ يَدَيْهِ وَبَعْدَ مَا هَاجَرَ إِلَى الْمَدِينَةِ سِتَّةَ عَشَرَ شَهْرًا ثُمَّ صُرِفَ إِلَى الْكَعْبَةِ