This question doesn’t have a brief answer. Please click on the detailed answer.
There are hadiths in hadith sources and history books stating that the prophet of Islam (pbuh) had foretold some of the things that were to take place (in Imam Ali's (as) time). We will mention some of these hadiths here:
1- The prophet’s (pbuh) prophecy during the peace treaty of Hudaybiyyah. After agreeing on the terms of the treaty, when Imam Ali (as) was writing the treaty, the representative of Quraysh objected to writing the phrase “بسم الله الرحمن الرحیم” at the top, and also to writing the title “رسول الله” after the name of the prophet, and this turned into a debate that prolonged the writing of the treaty. Eventually, because of certain reasons that were to the benefit of the Muslims, he had no choice but to accept what they said, and said to Ali (as), who wasn’t willing to erase the two phrases: “The same situation will take place for you and you will be forced give in to it.”[1] This prophecy took place in the battle of Siffin, when the event of the hakamiyyah (arbitration) took place, Imam Ali (as) was forced to erase the title “امیر المومنین” from the beginning of his name due to Mu’awiyyah’s insisting.[2]
2- In a hadith addressing Umm Salmah (the prophet’s (pbuh) wife), the prophet of Islam (pbuh) says: “O Umm Salmah! This is Ali (as), by God he is the killer of the Qasetin, Nakethin, and Mareqin after me!”[3]
In another hadith, the prophet (pbuh) lists some of these three’s attributes for Umm Salmah, in answer to her question about who these three groups are: “The Nakethin are those who give the bey’ah (allegiance) to Imam Ali (as) in Medinah, but break it in Basrah; the Qasetin are Mu’awiyyah and his companions in Sham (Damascus). As for the Mareqin, they are the people of Nahrawan.[4]
There are also hadiths narrated by Ammar Yassir and Abu Ayyub that convey the same thing.[5]
3- The prophet (pbuh) directly an in a unique way described and warned about how Mu’awiyyah would take power and sit on the prophet’s (pbuh) pulpit, and had commanded the Muslims to kill Mu’awiyyah if such a thing actually took place.[6]
4- When the prophet (pbuh) was dividing the war booty amongst his comrades, in order to encourage the idol worshippers who had recently turned Muslim, he gave them a bigger portion than the others. Hurqus, one of the founders to be of the Khawarij (the group who rose against Imam Ali (as) and eventually martyred him), objected to this act of the prophet (pbuh) and accused him of being unjust. The prophet (pbuh) answered: “If justice can't be found with me, then where is it supposed to be found?” What is even more important is what he said afterwards: “He (Hurqus) will have followers who will have fanaticism and profoundness regarding religion that all stem from ignorance. They will turn away from religion, as the arrow leaves the bow [when it is shot].”[7]
For further information, see:
1- Muhammad Baqir Majlisi, Biharul-Anwar, vol. 20.
2- Ahmad Abdul-Husein, Al-Ghadir, vol. 3.
3- Sheikh Tusi, Al-Amali
4- Tarikh Ya’qubi, vol. 2
5- Sahih Bukhari, vol. 3
6- Sahih Muslim, vol. 2
7- Ibn Athir, Al-Kamil fil-Tarikh, vol. 3
8- Ali Ahmadi Miyanji, Makatibul-Rasul, vol. 1
[1] Muhammad Baqir Majlisi, Biharul-Anwar, vol. 20, pp. 334 and 350; Ali Ahmadi Miyanji, Makatibul-Rasul, vol. 1, pp. 275 and 287.
[2] Ibn Wadhih Yaqubi, Ahmad ibn Abi Yaqub, Tarikh Yaqubi, vol. 2, pg. 179.; Abul-Hasan Ali ibn Abdil-Wahed, Al-Kamil fil-Tarikh, vol. 3, pg. 32.
[3] Ibn Asakir, Tarikh Damishq, vol. 42, pg. 470; Al-Hafidh Abil-Fada’ Ismail ibn Kathir Al-Damishqi, Al-Bidayah wal-Nihayah, vol. 7, pg. 306; Ali ibn Isa Arbali, Kashful-Ghummah, vol. 1, pg. 126; Allamah Amini, Al-Ghadir, vol. 3, pg. 188.
[4] Sheikh Tusi, Al-Amaliyy, pp. 425 and 464; Ahmad ibn Ali Tabarsi, Ihtijaj, vol. 1, pg. 462; Ma’anil-Akhbar, pg. 204.
[5] Tarikh Dameshq, vol. 42, pg. 472.
[6] Tarikh Dameshq, vol. 59, pg. 157.
[7] Abu Abdillah Muhammad ibn Ismail Al-Bukhari, Sahih Bukhari, vol. 3, pg. 1321; Al-Qashiri Neyshabouri, Muslim ibn Hajjaj, Sahih Muslim, vol. 2, pg. 774.