Luke 2:1-20: "In those days a decree went out from Caesar Augustus that all the world should be registered. This was the first registration when Quirinius was governor of Syria. And all went to be registered, each to his own town. And Joseph also went up from Galilee, from the town of Nazareth, to Judea, to the city of David, which is called Bethlehem, because he was of the house and lineage of David, to be registered with Mary, his betrothed, who was with child. And while they were there, the time came for her to give birth. And she gave birth to her firstborn son and wrapped him in swaddling cloths and laid him in a manger, because there was no place for them in the inn.
"And in the same region there were shepherds out in the field, keeping watch over their flock by night. And an angel of the Lord appeared to them, and the glory of the Lord shone around them, and they were filled with fear. And the angel said to them, 'Fear not, for behold, I bring you good news of great joy that will be for all the people. For unto you is born this day in the city of David a Savior, who is Christ the Lord. And this will be a sign for you: you will find a baby wrapped in swaddling cloths and lying in a manger.' And suddenly there was with the angel a multitude of the heavenly host praising God and saying, 'Glory to God in the highest, and on earth peace among those with whom he is pleased!'
"When the angels went away from them into heaven, the shepherds said to one another, 'Let us go over to Bethlehem and see this thing that has happened, which the Lord has made known to us.' And they went with haste and found Mary and Joseph, and the baby lying in a manger. And when they saw it, they made known the saying that had been told them concerning this child. And all who heard it wondered at what the shepherds told them. But Mary treasured up all these things, pondering them in her heart. And the shepherds returned, glorifying and praising God for all they had heard and seen, as it had been told them."
Matthew 2:1-11: "Now after Jesus was born in Bethlehem of Judea in the days of Herod the king, behold, wise men from the east came to Jerusalem, saying 'Where is he who has been born king of the Jews? For we saw his star when it rose and have come to worship him.' When Herod the king heard this, he was troubled, and all Jerusalem with him; and assembling all the chief priests and scribes of the people, he inquired of them where the Christ was to be born. They told him, 'In Bethlehem of Judea, for so it is written by the prophet: "And you, O Bethlehem, in the last of Judah, are by no means least among the rulers of Judah; for from you shall come a ruler who will shepherd my people Israel.'"
"Then Herod summoned the wise men secretly and ascertained from them what time the star had appeared. And he sent them to Bethlehem, saying, 'Go and search diligently for the child, and when you have found him, bring me word, that I too may come and worship him.' After listening to the king, they went on their way. And behold, the star that they had seen when it rose went before them until it came to rest over the place where the child was. When they saw the star, they rejoiced exceedingly with great joy. And going into the house they saw the child with Mary his mother, and they fell down and worshiped him. Then, opening their treasures, they offered him gifts, gold and frankincense and myrrh."
Philippians 2:5-8: "Have this mind among yourselves, which is yours in Christ Jesus, who, though he was in the form of God, did not count equality with God a thing to be grasped, but made himself nothing, taking the form of a servant, being born in the likeness of men. And being found in human form, he humbled himself by becoming obedient to the point of death, even death on a cross."
Isaiah 53:3-6: "He was despised and rejected by men; a man of sorrows, and acquainted with grief; and as one from whom men hide their faces he was despised, and we esteemed him not. Surely he has borne our griefs and carried our sorrows; yet we esteemed him stricken, smitten by God, and afflicted. But he was wounded for our transgressions; he was crushed for our iniquities; upon him was the chastisement that brought us peace, and with his stripes we are healed. All we like sheep have gone astray; we have turned - every one - to his own way; and the LORD has laid on him the iniquity of us all."
+++
The text is public domain:
What child is this, who, laid to rest,
On Mary's lap is sleeping?
Whom angels greet with anthems sweet
While shepherds watch are keeping?
This, this is Christ the king,
Whom shepherds guard and angels sing;
Haste, haste to bring Him laud,
The babe, the son of Mary!
Why lies He in such mean estate
Where ox and ass are feeding?
Good Christian, fear; for sinners here
The silent Word is pleading.
Nails, spear shall pierce Him through,
The cross be borne for me, for you;
Hail, hail the Word made flesh,
The babe, the son of Mary!
So bring Him incense, gold, and myrrh;
Come, peasant, king, to own Him.
The King of kings salvation brings;
Let loving hearts enthrone Him.
Raise, raise the song on high,
The virgin sings her lullaby;
Joy, joy, for Christ is born,
The babe, the son of Mary!
+++
The first verse is the most straightforward, as far as Biblical references go. Luke 2 is the only text is draws from. The beginning of the second verse also draws from this text, extrapolating about the rustic scene based on there being "no place for them in the inn."
The lines "Nails, spear shall pierce Him through, / The cross be borne for me, for you" seem to come from both the Philippians and Isaiah texts listed. The core of this sentiment in the hymn comes from this part of Isaiah: "he was wounded for our transgressions; he was crushed for our iniquities; upon him was the chastisement that brought us peace, and with his stripes we are healed." The "chastisement" of "nails [and] spear" is present in this verse, and the "peace" brought to us is the "salvation" in the next verse. (The "King of kings" appellation comes from Revelation 19:16, which isn't cited.) The Philippians text mentions the cross specifically ("he humbled himself by becoming obedient to the point of death, even death on a cross") where the Isaiah text is more general. The Philippians text is also the source of "the Word made flesh," although it phrases it as "born in the likeness of men." The hymn's "the Word made flesh" actually bears more resemblance to the first part of John 1:14: "And the Word became flesh and dwelt among us."
The beginning of the third verse ("So bring Him incense, gold, and myrrh") refers to the visit of the magi in the Matthew text.
I'd also like to point out that - like some other Christmas hymns - "What Child Is This" has the "angels sing[ing]," where in the Luke text, they're simply "saying, 'Glory to God in the highest....'"