When we first encounter this poem in The Fellowship of the Ring, its meaning is unknown, but we later learn that it is about Aragorn and the re-forging of the shards of Narsil. At the Council of Elrond, Bilbo tells Frodo that he had written it when he first found out who Aragorn truly was (namely, the rightful King of Gondor).
"All that is gold does not glitter": This is a twist on the known saying "All that glitters is not gold." Whereas the latter means that not everything that looks good actually is good, the former means the opposite: not everything that looks bad actually is bad. This is a perfect description of Aragorn: as a Ranger of the North, he looks dirty and unkempt, but despite that, he is one of the most valiant, valuable members of the Fellowship, not to mention heir to the throne of Gondor.
“Not all those who wander are lost”: As previously stated, Aragorn was a Ranger of the North, which means that he traveled around Eriador, protecting and exploring its borders.
“The old that is strong does not wither”: This is an allusion to the fact that Aragorn is a Dunedain, aka an heir of Numenor, which meant that he had a much longer life than most men. At 87, he was in fact in the prime of his life.
“Deep roots are not reached by the frost”: Aragorn was strong, both physically and mentally, and that meant that he would maintain his character despite any outside influences. It is also foreshadowing because, when Frodo gives him the chance to take the One Ring, he is able to resist its evil call.
“From the ashes a fire shall be woken”: At this point, the poem now starts to talk about re-forging the shards of Narsil into Anduril. This particular line has a few potential meanings: the most straightforward is that the forge is being re-lit in order to make the sword. On a deeper level, the ashes refer to the shards of Narsil, and Anduril is also known as “The Flame of the West," therefore a fire rose from the ashes. However, it could also be referring to Aragorn, who is sort of like a phoenix, rising from the ashes Isildur left behind.
“A light from the shadows shall spring”: This has a couple of meanings as well. The less important one is that the fire of the forge will light up. The more important one is that Aragorn, bearing the light of “The Flame of the West," is now ready to fight the shadows that plague the land because of Sauron’s returning darkness.
“Renewed shall be blade that was broken”: This one is pretty straightforward. Narsil was the broken sword that Isildur used to cut the One Ring from Sauron’s hand the first time Sauron was in power. Anduril is the sword the elves made using the remaining shards of Narsil, and they give it to Aragorn to aid in his fight against the darkness.
“The crownless again shall be king”: Again, this one is pretty straightforward. Aragorn has spent his life hiding from the title of King—he is crownless—but the events in The Lord of the Rings lead him to become what he was born to be: the King of Gondor.