The words to “O Come, O Come, Emmanuel” are a translation of the Catholic Latin text “Veni, veni, Emmanuel” by John Mason Neale in the mid-19th century. Their origins are very old indeed, and may date as far back as the 12th century. They were of such importance in medieval days that in monasteries a separate stanza, to be sung from December 16 through December 23, was assigned to each of the most pious monks. The text is based on the biblical prophecy from Isaiah 7:14 that states that God will give Israel a sign that will be called Immanuel (literally, “God with us”). In the 1800s, a musical setting that would accommodate the stanzas and the refrain “Rejoice! Rejoice! Emmanuel shall come to thee O Israel” was fashioned out of some plainsong sequences. (There was no refrain in the original Latin.) And, since plainsong has no measures and no specified rhythmic scheme, the quality of this hymn is always flowing and free.
https://music.justinreeve.com/o-come-o-come-emmanuel/