In Catholicism, civil/social authority is a distinctly good thing, patterned after and ordained by God's own authority. The Catholic Catechism has a whole article (and several reiterations of these themes) on social structures and authority.
PARTICIPATION IN SOCIAL LIFE
1898 Every human community needs an authority to govern it.
The foundation of such authority lies in human nature. It is necessary
for the unity of the state. Its role is to ensure as far as possible
the common good of the society.
1899 The authority
required by the moral order derives from God: “Let every person be
subject to the governing authorities. For there is no authority except
from God, and those that exist have been instituted by God. Therefore
he who resists the authorities resists what God has appointed, and
those who resist will incur judgment.” (CCC, Participation in Social Life)
So, it is my understanding that the Pope is morally obligated to submit all authorities in the communities to which he belongs, and presumably to a some extent in those communities he visits as well.
There is, as Alypius noted, an explicit exception.
Authority is exercised legitimately only when it seeks the common good
of the group concerned and if it employs morally licit means to attain
it. If rulers were to enact unjust laws or take measures contrary to
the moral order, such arrangements would not be binding in conscience.
In such a case, “authority breaks down completely and results in
shameful abuse.” (CCC
Hence, all Catholics, including the Pope, are required to submit to all rightful authorities in our communities and their laws, except those that are unjust or contrary to natural law or God's Law. And, we are morally obligated to disobey unjust or immoral laws.
Thus, disobedience in some settings can be a virtue and desirable
moral response, and civil disobedience is an option in some instances.
Blind obedience is not a value. Catholics must be alert not only to
the ways in which they might be tempted to participate in evil
intentionally and personally, but also the ways in which they might
participate in evil socially and structurally by observing,
tolerating, or ignoring systemic social and economic oppression. (Friends And Not Adversaries: A Catholic-Muslim Spiritual Journey)
Sorry, I couldn't quickly find a better, more focused resource for this.
Reiterating, the Pope, like every Catholic, is required to submit to the authorities in all communities in which he holds membership to the extent that the authority is rightful and just. In my understanding, this includes any law or dictate that is not distinctly opposed to justice and charity, enacted by a legitimate authority, wherein immunity has not been granted explicitly or implicitly. Bear in mind, since the Pope is sovereign of his own state, he is almost always granted diplomatic immunity.
Pope Gelasius I was the first pope recorded as enjoying diplomatic
immunity, as it is noted in his letter Duo sunt to emperor Anastasius.