Peter and his successors enjoy the charism known as “infallibility,” a gift that keeps them from giving out a false doctrine or moral teaching when one of them speaks as head of the Church to all Christians. It keeps them from uttering error, but does not cause them to know the truth by any special means other than the careful study of God’s revelation as it is contained in the Scriptures and the Tradition of the Church. The Pope (or the bishops together with the Pope) is (are) infallible when “exercising the extraordinary magisterium of the Church; that is when claiming to teach all men with this divine protection from error.
The Pope and bishops are also infallible (together or separately) when “exercising the ordinary magisterium” of the Church; that is when the contents of their teaching are in agreement with each other and with that of the popes and bishops who have gone before them.
Much of what I have just said about the conditions for the authentic teaching of the Church stems from the nature of truth itself. For example, truth must apply to all people; a doctrinal or moral proposition cannot be true for Czechoslovakians and false for Frenchmen. Likewise, such a proposition cannot be false yesterday, true today, and false again tomorrow; for moral and doctrinal truth is the reality of what is in the unchanging mind of God. Thus a proposition that is capable of being defined infallibly, by its very nature, is not capable of being changed by future popes or councils of bishops.
It should also be noted that the things that are the subjects of the Church’s magisterium (ordinary or extraordinary) are of the utmost importance. Our Lord became man and died on the Cross so that we might know them. They are the things that our loving God wants us to know about Himself, and to do in the conduct of our lives. Should anyone teach something contrary to what has been authentically defined by the magisterium, we are obligated to resist or ignore them. No one can oblige us to believe what is false about God, or to act in a manner contrary to His commands. “If an angel from heaven should preach a gospel to you other than that which we have preached to you, let him be anathema!” (Galatians 1)
If I might digress for a moment, it is important to distinguish the unchangeable pronouncements of the magisterium on faith and morals from two other kinds of pronouncement; pronouncements on knowledge and pronouncements on discipline:
Defective knowledge might, for example, cause theologians to be misinformed about the sun, earth, and stars — which, in turn, might cause them to misinterpret biblical passages concerning these things. More certain knowledge might bring about the revision of such (mis)interpretations. Likewise, a mistaken knowledge of reproductive biology might have led medieval theologians to conclude that a child receives a soul only after the passage of time in the womb of the mother (they thought of the child as a seed that took some number of days to sprout) — the theologians may change their conclusion based on better facts, but they may not change the moral principles by which those facts are evaluated.
The Church also has the power to make binding legislation as to discipline, and to change such disciplinary laws when appropriate. For example, the Church might prescribe abstinence from fish on Fridays at one time, change the abstinence to Wednesdays at another time, and abolish it altogether at another time. (There is, of course, an implied obligation to institute or change such practices only for good reason.)