Papal infallibility states that, by action of the Holy Spirit, the Pope is preserved from even the possibility of error when in his official capacity he solemnly declares or promulgates to the universal Church a dogmatic teaching on faith or morals. 
Ex Cathedra: In connection with papal infallibility, the Latin phrase ex cathedra (literally, “from the chair”) has been defined as meaning “when, in the exercise of his office as shepherd and teacher of all Christians, in virtue of his supreme apostolic authority, (the Bishop of Rome) defines a doctrine concerning faith or morals to be held by the whole Church”. 
In short, the Pope is the worst of the lot of the religious leaders. He (according to Matthew 16:19) has the power and authorisation to change what can and can’t be done on Earth, and will then be accepted in Heaven…
Just to keep you on your toes, the Holy See (Judicial body of the Catholic Church) won’t actually say what things are held to be infallible… Yup, they leave that door open just in case they want to change their minds or enforce something at a later date….
“…And I will give unto you the keys of the kingdom of heaven: and whatsoever you shall bind on earth shall be what has been bound in heaven: and whatsoever you shall loose on earth shall be what has been loosed in heaven.”
“…And I will give you the keys of the Kingdom of Heaven. Whatever you forbid on earth will be forbidden in heaven, and whatever you permit on earth will be permitted in heaven.”
Simply put, if the Pope says it’s cool to be gay, and same sex marriages are fine…. then ‘God‘ will accept that, as it is held true on Earth, then it’s all good for Heaven…. Same with abortion & contraception, etcetera.
If you have already jumped ahead in the thinking behind this, then yes…. the Pope can change anything to suit anything.
It’s a clause that would work really well in bringing the Bible and religion up to date to suit the way the world is now…
… but no…. The Pope retains these anti-gay, anti-abortion, anti-contraception (etc) views because they are the views that HE and his Storm Troopers hold, and these are the views he forces upon the world as “God’s words” – proving once more that the Church is just a power hungry political party that uses fictional story characters to scare people into living how THEY, the religious leaders, want them to live.
To be honest, I’m surprised the Pope hasn’t made child molesting within the upper ranks of the Church officially acceptable, as it would really get them all out of a lot of trouble…. Bastards.
,  – Source: Wikipedia