Papal infallibility was bestowed on Peter and his successors by Christ. We find evidence of this in Scripture. For example, Jesus told Peter, "Simon, Simon, behold, Satan demanded to have you, that he might sift you like wheat, but I have prayed for you that your faith may not fail; and when you have turned again, strengthen your brethren" (Luke 22:31-32). "And I tell you, you are Peter, and on this rock I will build my church, and the powers of death shall not prevail against it. I will give you the keys of the kingdom of heaven, and whatever you bind on earth shall be bound in heaven, and whatever you loose on earth shall be loosed in heaven" (Matt. 16:18-19).
Early Christians understood Christ’s teaching on the primacy of the pope, which involved papal infallibility. But the doctrine of papal infallibility was not infallibly defined until the First Vatican Council, as it was not necessary to formally define it until it was disputed. (Infallible pronouncements are usually made only when a doctrine has been challenged.)