This is a basic belief of Shia religion. Infallibility means no prophet or imam can commit any sin or mistake. If prophets or imams had not been infallible, then the whole religion of Allah would be suspicious.
In that case, there would be no authenticity in the words of the prophets. He is an example for humanity. If a prophet commits a sin, then this will become a sunnah for their followers. It will become compulsory upon their ummah (nation) to commit sins. Then the religion of Allah will become a joke. It should be remembered there are two types of infallibility. One is jabr i (forced). The other is iktiari (optional). Infallibility of the angels is jabri (forced). They do not have the free will to decide whether or not to obey or disobey the orders of Allah.
The infallibility of Masoomeen (as) is not jabri (forced). It is iktiari (optional). They do not commit any sins even though They have free will and the option to do so. This is the reason Their status is the highest from all of the creation of Allah. Infallibility is a compulsory aspect of nabuwiat (prophet hood) and imamate. Without infallibility, nabuwiat and imamate become worthless.