Much like the United States anthem, the Icelandic national anthem was originally written for a particular occasion and it probably did not occur to either the poet or the composer that the song was destined to become a national anthem.
In Iceland, nation-wide celebrations were held throughout 1874 to mark the 1000th anniversary of the first Norse settlement of the island. (This is the “Iceland’s thousand years” that are referenced in the anthem.) To mark the occassion, the Bishop of Iceland decreed that church services on August 2 of that year were to be held based on the anniversary, and the text to be presented was Psalm 90. The Rev. Matthías Jochumsson then decided to write a poem based on the Biblical text and the millennial anniversary. While abroad in Edinburgh, Scotland, he met up with Sveinbjörn Sveinbjörnsson, who Jochumsson asked to compose music for his poem.
While popular, it was not considered a national anthem. Icelandic independence was still over 40 years away. At the time that “Ó, Guð vors lands” (O, God of Our Land) was written, Icelanders usually sang “Eldgamla Ísafold” by Bjarni Thorarensen as a national anthem. However, that song had anti-Danish (the colonial power) lyrics and was set to the tune of the British national anthem. Therefore “Ó, Guð vors lands” (O, God of Our Land) was played as the national anthem when soverignity was proclaimed in 1918. The anthem has three verses, but the first is usually the one sung.
Special thanks to: Josh Lim for some of this information.