I've also answered the cross-posted version of this question on the Latin Language Stack Exchange.
One common attribution for this phrase is Thomas à Kempis's Imitation of Christ (~1420), which reads:
Tell me, where now are all the masters and teachers whom you knew so well in life and who were famous for their learning? Others have already taken their places and I know not whether they ever think of their predecessors. During life they seemed to be something; now they are seldom remembered. How quickly the glory of the world passes away! If only their lives had kept pace with their learning, then their study and reading would have been worth while. (Part 1, Chapter 3)
The phrase bolded above in the original Latin is o quam cito transit gloria mundi, so it's not an exact match, but the similarity is notable.
As the context indicates, Kempis is pointing out how fame and renown are fleeting: the acclaim that was showered on scholars during their lives has, following their deaths, been transferred to their successors. Kempis recommends, instead, that Christians ensure that "their lives [keep] pace with their learning," that is, that they live godly lives instead of seeking fame.
This message is by no means foreign to the Bible. Similar examples abound:
For the sun rises with its scorching heat and withers the grass; its flower falls, and its beauty perishes. So also will the rich man fade away in the midst of his pursuits. (James 1:11; ESV)
“Do not lay up for yourselves treasures on earth, where moth and rust destroy and where thieves break in and steal, 20 but lay up for yourselves treasures in heaven, where neither moth nor rust destroys and where thieves do not break in and steal. (Matthew 6:19–20; ESV)
And he told them a parable, saying, “The land of a rich man produced plentifully, 17 and he thought to himself, 'What shall I do, for I have nowhere to store my crops?' 18 And he said, 'I will do this: I will tear down my barns and build larger ones, and there I will store all my grain and my goods. 19 And I will say to my soul, “Soul, you have ample goods laid up for many years; relax, eat, drink, be merry.”' 20 But God said to him, 'Fool! This night your soul is required of you, and the things you have prepared, whose will they be?' 21 So is the one who lays up treasure for himself and is not rich toward God.” (Luke 12:16–21; ESV)
For all that is in the world—the desires of the flesh and the desires of the eyes and pride of life—is not from the Father but is from the world. 17 And the world is passing away along with its desires, but whoever does the will of God abides forever. (1 John 2:16–17; ESV)
The phrase is, as you mention, closely associated with the coronation of new popes. Janos M. Bak describes the process, writing that the words are spoken to the pope as a cloth is burned in front of him. The visual of a cloth being consumed in fire provides stark context for the phrase: it emphasizes the fleeting nature of worldy glory, and, by extension, the permanence of service to God.
In fact, the wording in Latin resembles that of Satan when tempting Jesus in the desert:
iterum adsumit eum diabolus in montem excelsum valde et ostendit ei omnia regna mundi et gloriam eorum (Matthew 4:8; Vulgate)
Again, the devil took him to a very high mountain and showed him all the kingdoms of the world and their glory. (ESV)
In response, Christ spurns worldly glory to serve God:
Then Jesus said to him, “Be gone, Satan! For it is written, “‘You shall worship the Lord your God and him only shall you serve.’” (4:10; ESV)
That's the attitude all followers of Christ need to have, but the reminder is especially relevant for those in positions of great power and prestige, like popes.