Virtually every society on earth has a tradition that we would recognize as "marriage." It may not be 100%, but it might be 99%. And this includes societies that haven’t been touched by religions we are familiar with, or Disney.
Some have have elaborate ceremonies, and some no ceremony at all.
But "why"?
I think the answer is simple.
Children.
Society, that’s us, collectively, doesn’t want to be burdened with destitute "illegitimate" children and their mothers.
Most societies treat such children and their mothers harshly, as a warning to others. "It takes a village" is silly; in this area, the "village" is likely to turn its back. It takes a couple. The village wants us to take care of our children, and maybe each other, as well. And I note that widows have an honored position in many societies.
The deal was, if we are allowed to engage in sex, we will take care of offspring. I wonder if it’s a mistake to allow men, mostly, to escape the deal they made. Does easy divorce help abused women? Of course, but it’s not without a cost.
In a modern society, there are many reasons to marry, as bigger had pointed out. But those reasons were not the genesis of marriage.
Children.