The Pope, who is successor of St Peter on whom Christ founded his Church (Matthew 16:18-29) is, by virtue of his office, the supreme pastor and teacher of the faithful.
Papal infallibility therefore, means that the Pope is prevented from teaching error or heresy when he proclaims a doctrine of faith or morals (CCC #891, Lumen Gentium #25, Pastor Aeternus #4).
The primary function of the Church is to teach for salvation. The Holy Spirit, who governs and guides the Church prevents the Pope from teaching error or heresy because if it fails to teach the truth and teaches error, then it fails to be the Church of Jesus Christ, handed down through St Peter, in fulfillment of God's plan for the salvation of mankind. (CCC #776).
"Anyone who listens to you listens to me; anyone who rejects you rejects me, and those who reject me reject the one who sent me." Luke 10:16
Papal infallibility was first defined by the First Vatican Council in 1870. There are only 2 examples of the Pope exercising this doctrine in the history of the Catholic Church:
The dogma of the Immaculate Conception of the Blessed Virgin Mary by Pope Pius IX in 1854
The dogma of the Assumption of the Blessed Virgin Mary by Pope Pius XII in 1950
Material produced in collaboration with the Agency for Evangelisation in the Diocese of Westminster.