What is hajj in islam? What is the obligatory pligrimage?
Hajj was already a continuing practice performed annually according to the Hanif religion of Ibrahim -upon him peace-, mixed however with many idolater rituals. In the ninth year of Hegira, assigning Abu Bakr -Allah be well-pleased with him- as amir, or leader of the pilgrims, the Blessed Prophet -upon him blessings and peace- sent a group of three-hundred Companions to Mecca to teach Muslims how to perform their hajj, declaring he would personally attend the pilgrimage the following year. He also had the group take twenty-camels, each of them marked, to be sacrificed as part of hajj.
As Abu Bakr -Allah be well-pleased with him- was leading the group out of Medina, the first few ayat of surah at-Tawbah were revealed, commanding the vicinity of the Sacred House to be purged of idolaters, just as it had recently been purged of idols. Until then, idolaters had been left free to perform their worship in Kaabah. But now, with Kaabah restored with its original identity, the immoral style of idolater worship, consisting of circumambulating naked with a boisterous clap of hands, was no longer befitting of tawhid, and was moreover causing uproar among the public. Thus, the ayat of at-Tawbah spelled an end to the deeds of disrespect comitted in front of the Sacred House:
“(This is a declaration of) immunity by Allah and His Messenger towards those of the idolaters with whom you made an agreement. So go about in the land for four months and know that you cannot weaken Allah and that Allah will bring disgrace to the unbelievers. And an announcement from Allah and His Messenger to the people on the day of the greater pilgrimage that Allah and His Messenger are free from liability to the idolaters; therefore if you repent, it will be better for you, and if you turn back, then know that you will not weaken Allah; and announce painful punishment to those who disbelieve. Except those of the idolaters with whom you made an agreement, then they have not failed you in anything and have not backed up any one against you, so fulfill their agreement to the end of their term; surely Allah loves those who are careful (of their duty).” (at-Tawbah, 1-4)
“O you who believe! The idolaters are nothing but unclean, so they shall not approach the Sacred Mosque after this year; and if you fear poverty then Allah will enrich you out of His grace if He please; surely Allah is Knowing Wise.” (at-Tawbah, 28)
The Blessed Prophet -upon him blessings and peace- sent Ali -Allah be well-pleased with him-, behind Abu Bakr -Allah be well-pleased with him-, to announce the above ayat in Mecca. On they first day of eid, Ali -Allah be well-pleased with him- stood near Aqabah and carried out the duty he had been entrusted through a sermon. After reading the ayah, he announced the four terms laid down by the Prophet of Allah -upon him blessings and peace- for everyone to hear:
1) Only Believers were to enter Paradise.
2) The idolatrous innovation of circumambulating Kaabah naked was to end and would no longer be tolerated.
3) No mushriq was to be allowed in the vicinity of Kaabah from that year onwards.
4) As for the idolaters who had a pact with the Prophet of Allah -upon him blessings and peace- to which they were remaining loyal, the pacts were to stay in force until the end of the designated terms.
No idolater, after that year, was able to come to hajj, and it would be the final time Kaabah was circumambulated in the ways of old. Besides, the handful of idolaters that remained came to terms with how degrading a position their beliefs had put them in and finally succumbed to Islam. Just as it had been cleared of idols before, Kaabah was now also purged of idolaters and had become ready for the Great Hajj the Blessed Prophet -upon him blessings and peace- was set to attend the following year.
 Ibn Hisham, IV, 201; Tirmidhi, Hajj, 44/871; Waqidi, III, 1077.