The New Testament shows the apostles setting up, after their Master’s instructions, a visible organization, and that every Christian writer in the early centuries—in fact, nearly all Christians until the Reformation—fully recognized that Christ set up an ongoing organization.
One example of this ancient belief comes to us from Ignatius of Antioch. In his second-century letter to the church in Smyrna, he wrote, “Wherever the bishop appears, let the people be there; just as wherever Jesus Christ is, there is the Catholic Church” (Letter to the Smyrnaeans, 8, 1 [A.D. 110]).
If Christ did set up such an organization, he must have provided for its continuation, for its easy identification (that is, it had to be visible so it could be found), and, since he would be gone from earth, for some method by which it could preserve his teachings intact.
All this was accomplished through the apostolic succession of bishops, and the preservation of the Christian message, in its fullness, was guaranteed through the gift of infallibility, of the Church as a whole, but mainly through its Christ-appointed leaders, the bishops (as a whole) and the pope (as an individual).
It is the Holy Spirit who prevents the pope from officially teaching error, and this charism follows necessarily from the existence of the Church itself. If, as Christ promised, the gates of hell will not prevail against the Church then it must be protected from fundamentally falling into error and thus away from Christ. It must prove itself to be a perfectly steady guide in matters pertaining to salvation.
Of course, infallibility does not include a guarantee that any particular pope won’t “neglect” to teach the truth, or that he will be sinless, or that mere disciplinary decisions will be intelligently made. It would be nice if he were omniscient or impeccable, but his not being so will fail to bring about the destruction of the Church.
But he must be able to teach rightly, since instruction for the sake of salvation is a primary function of the Church. For men to be saved, they must know what is to be believed. They must have a perfectly steady rock to build upon and to trust as the source of solemn Christian teaching. And that’s why papal infallibility exists.
Since Christ said the gates of hell would not prevail against his Church (Matt. 16:18b), this means that his Church can never pass out of existence. But if the Church ever apostasized by teaching heresy, then it would cease to exist; because it would cease to be Jesus’ Church. Thus the Church cannot teach heresy, meaning that anything it solemnly defines for the faithful to believe is true. This same reality is reflected in the Apostle Paul’s statement that the Church is “the pillar and foundation of the truth” (1 Tim. 3:15). If the Church is the foundation of religious truth in this world, then it is God’s own spokesman. As Christ told his disciples: “He who hears you hears me, and he who rejects you rejects me, and he who rejects me rejects him who sent me” (Luke 10:16).