Prior to about the mid-18-century, marriage was strictly a church affair, that concerned neither king nor country. It was only with the rise of "democracy," specifically urban, precinct and ward-based voter rolls, that governments become aggressively desirous of keeping track of who was sleeping with whom -- and that is approximately when government licensing of marriages started to became pervasive. It was never about health, children, morals, or anything valuable to the public welfare; it was about canvassing and vote extortion.
As for gay marriage, much, much earlier than the appearance of government-sanction marriage, clear back to the start of the Christian church, the practise of blessing same sex unions, male-male and female-female, existed. (Well, even before that, the Pagans had little problem with it either, but the traitor Constantine pretty much undermined any decency the Pagans might have offered to posterity.) While such same sex unions were likely just as statistically rare then as today, it was at least common enough for there to be historical record of it.
It was only with the rise of the officially-sanction misogyny of Catholic dogma, latter to be adopted by the fundamentalist sects of Protestism, that hatred toward women, blacks, and homosexuals became pervasive (even though a form of church-santion, same-sex recognition did continue in France into the 18th century). There is nothing ancient or sanctimonious about either government-sanctioned marriage or government-sanctioned homophobia, both are new concepts, almost younger than America.
Oddly enough, America churches have been so successful at scrubbing and rewritten their history of overt racism that it is vertitualy unknown by the current generation, even amongst African Americans who are amongst the most devout populations in the country. It is ironic that many Black Americans belong to very congregations that not 40 years ago would not have allowed them to "darken" their door, and whose members, only a few years earlier, would have been burning crosses in their yards. The Snarkmeister is hardly ancient, but even he can remember hearing racist bile spewed from the pulpit of his childhood church, just as he hears hate against homosexual preached from America's pulpits today.
It is particularly interesting to note that the Mormons, the Church of the Latter Day Saints, which paid 70% of the cost of Proposition 8, did not allow African American's to be fully equal members of its congregation until 1978. The Mormons are retrogrades, who were pulled out of the 18th century by the U.S. courts, and who are are now fighting back at the ballot box. That is understandable, except for the fact that they have no right to drag the whole of America back into the Dark Ages with them. Thank God, we dodged the Romney bullet.