The argument goes like this:
When agriculture and sedentarism started many men acquired fortunes, they wanted to leave their plantations or the leadership of their settlements to their children, but how could they be sure the children of any given woman were his?
In the other hand, women could have children from several men and probably wanted help rising them, specially if that men was wealthy
Thus marriages were invented. The woman promised not to have sex with other men, while the man promised to take care of the children and not have children with other women that would take resources away from the "primary children", if such children were to be born then they would be considered illegitimate and not be entitled to the same level of resources
Thus in one fell swoop we had marriages as a social contract and the concept of bastards
This is why many societies accepted LGBT people while not allowing them to get married, because the sole purpose of marriage was to have children. For that reason the romans, greeks, sumerians and many more were happy to go around having gay sex and being open about it, but never wanted to get married with people of their same gender
Only recently that political power is mostly not inherited, that poverty has decreased considerably, allowing for most children to grow up healthy and educated (in many countries) that marriage became related to love, thus sparking the desire for gay marriage
Is this assessment accurate?
That explanation has some implicit assumptions in it that we need to explore.
That theory only really makes sense if you assume that a society is patriarchal patrilineal. In patriarchal patrilineal societies, children are recognized as offspring of the father, and can inherit goods or social position from their father.
However, in matrilineal societies, children are reckoned as belonging to the clan/lineage of their mother. A possible reason why societies might prefer to reckon descent in such a way is because there should be no doubt who a child's mother is (because duh), while paternity might be in doubt. So, for instance among the Yamasee people in what is now South Carolina, the primary male influence in a child's life would be their uncle (that is, their mother's brother). Questions of inheritance could vary from society-to-society, but in many matrilineal societies, inheritance or social status could be passed from uncle to nephew. Edit- here is an explanation Akan kinship titles where inheritance can go from mother's brother to son. Of note, inheritance would first go to surviving brother in the older generation, and eventually go uncle-nephew when the elder generation dies out.
The other issue is that that schematic of marriage seems to assume monogamy. Historically, there are numerous examples of polygamous (one husband, multiple wives) as well as polyandrous (one wife, multiple husbands) societies.
In instances where polyandry was accepted, you run into the "problem" of paternity. That is, how is a husband (and his relatives) to know with certainty whether the child is his or is descended from another co-husband?
And in the case of polygamy, there are a few problems. If a man has multiple wives, it would be quite difficult for him to take an equal part in child-rearing as the wife. From an inheritance point of view, there is risk that with multiple wives might come an abundance of children, so that a patriarch's wealth might be equally divided into small fractions for the 7 or 8 or 10 heirs.
Now, that is a slightly reductive explanation for polygamy. Wives might be able to count on co-wives to help in some parenting duties, thus lightening the load.
Additionally, in many polygamous societies, we see distinctions made between "senior wives" and "junior wives" where children of the first wife (or sometimes the wife with the most politically powerful family) were preferred in inheritance, while children of junior wives were not guaranteed much if any inheritance.
This is all important because, we shouldn't automatically assume that the earliest forms of marriage were patriarchal and monogamous. Marriage as a social phenomenon pre-dates writing, and so it can be challenging to determine what earliest marriage looked like. We can't and shouldn't assume that marriage in Mesopotamian form (when we have the earliest writing) represents the "original form".
Now, I'll admit that I don't know enough to talk about the Western tradition of marriage, with respect to hostility (or openness) to gay marriage, and the assumption that marriage is intended for procreation.
However, works like Boy-wives and Female-husbands by Murray and Roscoe talk about male-male marriage, male-male sexuality, and woman-woman marriage in 19th and 20th century Africa.
So, at least some non-western societies recognized same-sex marriage as valid.
You might get additional info from /r/AskAnthropology.