Actually, scripture doesn't say that -- not exactly.
However, despite the Daily Caller's take that Obama completely "made up" a line of Bible verse out of "narcissism" in order to drive home a point about his stance on immigration, it should be noted that the sentiment behind the "glass houses" idiom is quite clearly found in the Bible.
The closest the Bible comes to what Obama said is a pretty well-known line that includes a proverb about the log in one's eye -- a line Obama didn't quite get right.
"Do not judge, so that you may not be judged. For with the judgment you make you will be judged, and the measure you give will be the measure you get. Why do you see the speck in your neighbor’s eye, but do not notice the log in your own eye? Why do you see the speck in your neighbor’s eye, but do not notice the log in your own eye? Or how can you say to your neighbor, ‘Let me take the speck out of your eye,’ while the log is in your own eye? You hypocrite, first take the log out of your own eye, and then you will see clearly to take the speck out of your neighbor’s eye."
That's from a more modern translation of the Sermon on the Mount. The King James version gets a lot closer to what Obama said: "And why beholdest thou the mote that is in thy brother's eye, but considerest not the beam that is in thine own eye?"
"Mote" is a kind of antiquated word for "speck." It's a homonym with "moat" -- as in, a body of water around a castle -- which is the spelling used in some quotations of Obama's remarks. It's impossible to know which version of the word he thought he was using in the quote.
There are other resonances, for instance, in John, "He who is without sin among you, let him be the first to throw a stone at her." A similar saying also appears in the wisdom book of Sirach, which is considered a canonical part of the Bible in Catholicism but not by Protestants:
Whoever throws a stone straight up throws it on his own head, and a treacherous blow opens up many wounds. Whoever digs a pit will fall into it, and whoever sets a snare will be caught in it. If a person does evil, it will roll back upon him, and he will not know where it came from.
The expression "they that live in glass houses should not throw stones" is a proverb of unknown origin that has been used in various form for centuries. It's used, for example, in Chaucer's Troilus and Criseyde, which was likely written in the 1380s: "And for-thy, who that hath an heed of verre, Fro cast of stones war him in the werre!," Chaucer wrote.
It translates (very) roughly to, "And therefore, who that has a head of glass, to cast of stones let him beware."
As Dwight Edwards Marvin writes in 1922's "The Antiquity of Proverbs," the saying is usually attributed to James I of England, even though he lived after Chaucer. Marvin guesses that the saying probably has its roots in Spain, although the sentiment precedes the imagery.
As The Week notes, Obama's Nashville remarks also ruffled some conservative feathers on a theological quibble about the story of Jesus's birth. Responding to a statement from Father Joseph Freen, who wished Obama a merry Christmas, the president replied:
Well, I appreciate that very much. That’s very nice. Thank you. (Applause.)I appreciate that, Father. It’s worth considering the Good Book when you’re thinking about immigration. This Christmas season there’s a whole story about a young, soon-to-be-mother and her husband of modest means looking for a place to house themselves for the night, and there’s no room at the inn.And as I said the day that I announced these executive actions, we were once strangers too. And part of what my faith teaches me is to look upon the stranger as part of myself. And during this Christmas season, that’s a good place to start.So thank you for your generous comment. But if we’re serious about the Christmas season, now is a good time to reflect on those who are strangers in our midst, and remember what it was like to be a stranger.
The issue here seems to be that Mary and Joseph were not literally "illegal immigrants," but in fact (according to the Gospel of Luke's version of the story) were following a law that required them to return to Joseph's homeland for a census.
However, the historical accuracy of Luke's version is a subject of much debate among New Testament scholars.
Obama might have had a better case had he turned to another gospel, Matthew, in which Joseph, Mary and Jesus are instructed by an angel to flee from Jesus's birthplace of Bethlehem to Egypt, in order to escape the wrath of King Herod. The family stays there until Herod's death, and eventually returns to settle in Nazareth.
[This post has been updated]