The Qiblah is the direction that should be faced when a Muslim prays during salah. Most masajid contain a wall niche, known as mihrab, that indicates the Qiblah. Five times each day more than a billion Muslims around the globe face Makkah as they perform their daily prayers. The compass direction of the Qiblah, the sacred direction in Islam, thus it is of great importance for every Muslim. The Qiblah has importance beyond salaat and plays a part in various ceremonies, Like after death, Muslims are buried with their heads in the direction of the Qiblah.
Qiblah is a sign of the spiritual unity of all Muslims worldwide under the law of one God i.e., Allahسبحانه و تعالى. The Qiblah is important because it gives us a sense of unity, uniformity and discipline. If there were no Qiblah, we would pray as isolated groups without being connected to one another. The Qiblah gives us a focus; a common sense of purpose; a direction. 
Qur'an states as: "We have certainly seen the turning of your face, [O Muhammad], toward the heaven, and We will surely turn you to a qiblah 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." Qur’an.Surah Baqarah2:144
When the Prophet Muhammad ﷺcame to Medina, he stayed first with his grandfathers or maternal uncles from Ansar. He offered his prayers facing Baitul-Maqdis (Jerusalem) for sixteen or seventeen months, but he wished that he could pray facing the Ka'ba (at Mecca). The first prayer which he offered facing the Ka'ba was the 'Asr prayer in the company of some people. Then one of those who had offered that prayer with him came out and passed by some people in a mosque who were bowing during their prayers (facing Jerusalem). He said addressing them, "By Allahسبحانه و تعالى, I testify that I have prayed with Allah's Messenger Muhammad ﷺfacing Mecca (Ka'ba).' Hearing that, those people changed their direction towards the Ka'ba immediately. Jews and the people of the scriptures used to be pleased to see the Prophet Muhammad ﷺfacing Jerusalem in prayers but when he changed his direction towards the Ka'ba, during the prayers, they disapproved of it.
Al-Bara' added, "Before we changed our direction towards the Ka'ba (Mecca) in prayers, some Muslims had died or had been killed and we did not know what to say about them (regarding their prayers.) Allah سبحانه و تعالىthen revealed: And Allah would never make your faith (prayers) to be lost (i.e. the prayers of those Muslims were valid).' " (Quran.Surah Baqarah 2:143), Sahih Al Bukhari Vol 1:39
Al-Masjid al-Aqsa (in Jerusalem) was the first of the two qiblahs, and is one of the three mosques to which people may travel for the purpose of worship. And it was said that it was built by Sulaymaan (peace be upon him), as stated in Sunan al-Nasaa’i (693) and classed as saheeh by al-Albaani in Saheeh al-Nasaa’i. And it was said that it existed before Sulaymaan (peace be upon him) and that Sulaymaan rebuilt it; this is based on the evidence narrated in al-Saheehayn from Abu Dharr (may Allaah be pleased with him) who said: “I said, ‘O Messenger of Allaah, which mosque was built on earth first?’ He said, ‘Al-Masjid al-Haraam [in Makkah].’ I said, ‘Then which?’ He said, ‘Al-Masjid al-Aqsa.’ I said, ‘How much time was there between them?’ He said, ‘Forty years. So wherever you are when the time for prayer comes, pray, for that is the best thing to do.’” Sahih Al Bukhaari, 3366 and Sahi Muslim, 520 
Originally, the Qiblah for Muslims was toward the Noble Sanctuary in Jerusalem called as Masjid E Aqsa. This Qiblah was used for over 13 years, from 610 CE until 623 CE. Seventeen months after prophet Muhammad's 622 CE arrival in Medina – the date is given as 11 February 624 CE – the Qiblah became oriented towards the Kaaba in Makkah. According to traditional accounts from Muhammad's companions, the change happened very suddenly during the noon prayer in Medina, in a masjid now known as Masjid al-Qiblatain (Mosque of the Two Qiblahs). Muhammad was leading the prayer when he received revelations from Allah سبحانه و تعالى instructing him to take the Kaaba as the Qiblah: “ So turn your face toward al-Masjid al-Haram. And wherever you [believers] are, turn your faces toward it [in prayer]” Quran.Surah Baqarah2:144
It is reported in the Sahihayn (Sahih Al-Bukhari and Sahih Muslim) that Ibn `Umar narrated: While the people were in Quba' (Mosque) performing the Fajr (Dawn) prayer, a man came and said, "A (part of the) Qur'an was revealed tonight to Allah's Messenger and he was commanded to face the Ka`bah. Therefore, face the Ka`bah. They were facing Ash-Sham, so they turned towards the Ka`bah. 
The change of Qiblah from Baitul-Maqdis to Sacred Masjid of Kaabah was a puzzle for everyone; those, who were of the opinion that every rule ought to be permanent and unchanging, mused: If we had to necessarily pray in the direction of the Kaabah, why was it not ordered from the very onset? And if Baitul-Maqdis, which had been regarded as the Qiblah for the previous Prophets, was superior, why then was it changed?
The enemies too found the issue a fertile ground to poison the minds of the people. They probably might have said: At the start Prophet Mohammed ﷺturned towards the Qiblah of the previous Prophets but after tasting victories he was overcome by racial and nationalistic tendencies and therefore substituted it with the Qiblah of his own people! Or they might have said: Prophet Mohammed ﷺinitially accepted Baitul-Maqdis to be his Qiblah in order to attract the Jews and the Christians towards his religion, but later, when he observed that it did not prove effective, he changed it to Kaabah.
The agitation and commotion that these whisperings must have generated - especially in a society in which the sediments of the eras of idolatry and polytheism still existed, and one that had yet to be completely illuminated by the light of knowledge, science, and faith - is all too evident. And it is for this reason that the Glorious Qur'an explicitly states that this was a great trial to discern the stance adopted by the believers and the polytheists.Quran.Surah Baqarah 2:143
In this manner the believers were placed in a crucible of examination in order that the traces of polytheism, which still existed within themselves, get burnt away in the hot furnace of this test, they sever their association with their polytheistic past, and there develops within them the spirit of absolute submission before the orders of Allah سبحانه و تعالى.
Islam is a religion of unity. Muslims are united by their belief in One God. They are one brotherhood united in the language and ritual of prayer and united by the direction of their worship. The Qibla is not only about degrees of latitude or longitude it is about unity. It is about humankind united in the worship of the One God, Creator, and Sustainer of the universe.