From many a source on the intraweb, if they're to be believed...
The Pledge of Allegiance was written by Francis Bellamy in 1892. "Under God" was not part of the original pledge, and was added by Congress in 1954 after a campaign by the Knights of Columbus in response to the "godless communist threat." Though oddly enough Bellamy was considered a Socialist. But anyway, here's a quote attributed to Bellamy about his Pledge... Combine that with "In God We Trust" being added to currency by Congress in 1955, again in response to the Red Scare, and you have a significant (recent) shift.
And religion keeps coming into play with the gay marriage debate because religious dogma and the Bible is always referenced when opposing it. That should have no effect on how couples are viewed by the law. If that means removing the word marriage from the issue, and speaking only in terms of civil unions with respect to law, then so be it.