Islam emphasizes strongly over offering Salah as an obligatory ritual for obedience towards unification of Allah. Being the second pillar of Islam, Salah ordered for spiritual, moral and physical benefits of Muslims. During earlier days of Islam, prayer was not obligatory for Muslims until Holy Prophet PBUH went on a journey of Isra and Miraj. Earlier Holy Prophet used to pray along with his companions as a voluntary activity. Later, the visit of Israa and Miraj Allah made it obligatory for Muslims to offer five times prayers a day. Muslims kept on offering voluntary prayers in Mecca for two rakaat twice a day at dawn and dusk. The obligatory ritual of prayer ordered just before one and a half year before migration to Madinah.
Despite disciplined offering of Salah five times a day after the visit of Holy Prophet PBUH to Israa and Miraj, Muslims kept on offering prayer while facing Masjid Al-Aqsa. This site is considered as holiest for Muslims after Mecca and Madinah Masjids. It is in Jerusalem and Jews used to face the same masjid while performing their religious rituals. Holy Prophet PBUH performed prayers for 13 years of his prophethood. Despite his heartiest desire for Kaaba as Islamic Qibla he PBUH never asked Allah SWT for changing of Qibla to avoid any act of disobedience.
After migration to Madinah, Holy Prophet PBUH and his followers kept on facing Al Masjid Al-Aqsa while offering Salah. This practice brought Muslims in a controversial position as Jews were also offering their religious rituals while facing the same focal point. When Jews used heart-rending comments for Muslims due to the adoption of Al Masjid Al-Aqsa as their Qibla, Muhammad (PBUH) desired keenly that they could switch to Kaaba as their spiritual center of prayers. After one and a half year of migration to Madinah, Allah sent Jibraeel (A.S) to ask Holy Prophet PBUH for changing the direction of their face while offering Asar Prayer. Muslims immediately turned their faces to Mecca and afterward it became the forever Center of Muslims’ prayers. Meanwhile, Allah sent this message for his beloved Prophet (PBUH)
I have certainly seen the turning of your face, [O Muhammad], toward the heaven, and I will surely turn you to a Qibla with which you will be pleased. So, turn your face toward Al-Masjid Al-Haram. And wherever you [believers] are, turn your faces toward it [in prayer]. Indeed, those who have been given the Scripture well know that it is the truth from their Lord. And Allah is not unaware of what they do. (Chapter 2, verse 144)
The basic need for changing of Qibla arose when Jews started commenting that Muslims use to face the same Qibla as they do, it means there is no innovation in Islam and it is same as Judaism. Jews refused to become Muslims by arguing the fact that if Muslims are facing their Qibla, it shows they need to change their religion and become Jews. Holy Prophet PBUH was keenly intended for changing the Qibla. Kaaba was so dear to Muslims due to its association with Prophet Ibrahim and Ismail (peace be upon him).
It was expected that Allah will assign Kaaba as Islamic Qibla but on the visit Miraj, Holy Prophet PBUH led the congregational Salah of all Prophets in Al-Masjid Al-Aqsa. Allah ordered Apostle of Allah to follow this mosque as Qibla. The order for change of Qibla bestowed on Muslims in the middle of Sha’ban during the second year of Hijra which completely shut down the criticizing comments of Jews regarding Qibla of Muslims.