He struck up at once a harvest thanksgiving hymn, all about crops being "safely gathered in". It was not very suitable to a place which felt as if nothing had ever grown there since the beginning of time, but it was the one he could remember best. (The Magician's Nephew)
After bringing the witch from Charn into our own world, Digory is finally able to maneuver her first to the Woods between the Worlds and finally into a random pool to Nothingness. Unfortunately, in doing so, he brings along his Uncle Andrew, and a London cabby with his horse. Not being aware of magic and other worlds, the cabby assumes that they have either fallen into some underground diggings or are dead. Either way, he feels that singing a hymn seems like a positive thing to do and starts one as described above.
As Lewis notes, the cabby's choice of hymn is questionable. After all they are in complete Nothingness and though the Nothingness will soon become Narnia, it is not as of yet. Furthermore, no doubt a hymn of salvation would be far more appropriate for the situation they find themselves.
However, perhaps we are not giving Frank, the cabby and soon to be first King of Narnia, enough credit. King Frank, as the first human inhabitant of Narnia, is an Adam-like figure in the Chronicles. Indeed, when Tirian is brought before King Frank and Queen Helen at the end of "The Last Battle" he, "felt as if you were brought before Adam and Eve in all their glory." And the harvest hymn, far from being inappropriate, is necessary for the creation of Narnia.
One of the primary apparent differences between the Creation stories of Genesis 1 and Genesis 2 is the role of Adam. In Genesis 1 Adam appears at the end of Creation and is given rulership over, "the fish of the sea and the birds of the sky..." In Genesis 2 Adam is mentioned right at the beginning. The bible explains that, though there is land, there is not yet any vegetation, "for God has not caused it to rain on the ground and there is no man to work the land." Rashi, based on the Talmud, explains that without man there is no one to recognize the goodness brought by rain. It is necessary for man to be created and then pray for rain in order for things to grow. In fact, Frank's ability to grow food is one of Aslan's first criteria needed to be a proper king of Narnia.
It is true that the cabby (soon to be turned king) remembered the harvest hymn best and sung it for that reason. But prayers, even Thanksgiving prayers, are more than just thanks for the past. They can point to a new future in which there will be even more to be thankful for.
The harvest hymn sung by the cabby, Digory, and Polly, is the prayer that sparks the creation of Narnia.