The treaty of Hudaibiyyah aimed to save Muslims from the harm of the Infidels of Quraish. Fighting with the Infidels of Quraish at that time and situation was not useful at all for Muslims, that is why the Prophet (SAWA) made that treaty to safeguard the interest of Islam and Muslims.
The Treaty of Hudaybiyyah is very important event in the history of early Islam. After the signing of the treaty, the Quraysh of Mecca no longer considered Muhammad to be a rebel or a fugitive from Mecca. It also allowed the Muslims who were still in Makkah to practice Islam freely. In addition, the Treaty of Hudaybiyyah paved the way for many other tribes to make treaties with the Muslims and many Arab tribes to become near to Islam and ultimately become Muslims.