[Machine] The Prophet ﷺ used to pray towards the direction of Masjid al-Aqsa and the Kaaba, with both of them in front of him. After moving to Medina, he continued to pray in this direction for sixteen months, then Allah Almighty changed the direction towards the Kaaba.
أَنَّ النَّبِيَّ ﷺ كَانَ يُصَلِّي نَحْوَ بَيْتِ الْمَقْدِسِ وَالْكَعْبَةُ بَيْنَ يَدَيْهِ وَبَعْدَ مَا تَحَوَّلَ إِلَى الْمَدِينَةِ سِتَّةَ عَشَرَ شَهْرًا ثُمَّ صَرَفَهُ اللهُ تَعَالَى إِلَى الْكَعْبَةِ