Marriage certainly predates agriculture. Every known hunter-gatherer society had marriage, from Inuits to Yanamamo to !Kung to Tasmanian aborigines. Of course “marriage” doesn’t always mean exactly the same thing in different cultures, and in most hunter-gatherer societies marriage is a lot looser and less formal than it was in, say, Victorian England.
Humans have an interesting and unique social structure among mammals. The two most common mammal social structures are harems and solitaryness.
In harems, females form a social group. Female offspring join the group, male offspring are expelled once they reach breeding age. The males either become solitary or form bachelor herds. The harem has one sexually mature male, who defends his status against other males. If he loses a confrontation against another male he loses his status, if he wins he keeps it. I say confrontation rather than fight, because in many or most cases physical violence is not engaged in…one of the males judges that he is incapable of winnng a physical fight and runs away. Gorillas have this structure.
Solitary animals are, well, solitary. The come together only during mating season, although male and female territories may overlap. Males confront each other over access to females during mating season, but it is also common for every member of the species to behave aggressively towards any other member of the species that enters into their territory at any time. Orangutans have this structure.
Also present are mixed groups. All sexes form a social group, and during mating season dominant males mate with the females and attempt to exclude subordinate males. Chimpanzees have this social structure.
Some species have long term mated pairs, where each pair jointly controls a territory. This system is common among birds, but less so among mammals. Gibbons have this social structure.
But humans have long-term mated pairs WITHIN mixed groups. Again, this occurs in birds, but is very uncommon among mammals. If you read a lot of natural history stories for kids, you often see the authors imposing human social patterns on animals that have radically different patterns. In any case, just as among humans, pair-bonded birds often commit “adultery” and mate and produce offspring with individuals they are not pair-bonded too. Happens all the time. Humans are different than most mammals in that sexually mature males tolerate the presence of other sexually mature males around “their” females.
The interesting thing about social structures is that they influence the evolution of the species. When males confront other males over mating rights, males typically are larger than females. When male-male confrontations are rare, males and females are about the same size. Male and female gibbons are identical in size, while male gorillas are 2 or 3 times the weight of females. Humans are in between…the average male is 20-30% larger than the average female. That indicates a large pair-bonding component but with some male-male competition mixed in. And you can see that pattern played out every weekend at your average country-western bar.
Social structure also has an effect on testes size and sperm production. Mammals with harems typically have small testes and produce small amounts of sperm. Among mammals where females have the opportunity to mate with several males during mating season, males have large testes and produce many sperm, because of sperm competition. Gorillas and gibbons have very small testes, chimpanzees have very large testes, and humans have medium-sized testes. Again, this indicates that humans have evolved in an environment where a male human has a certain amount of sexual exclusivity with a female, but sometimes faces sperm competition.
From this, we can conclude that our current social structure is probably very long standing. We didn’t have a chimpanzee-like or gorilla-like or gibbon-like or orangutan-like social structure anytime in the recent past. Exactly when humans evolved our current structure that includes “marriage” is unknown, but it probably is at least as old as fully modern Homo sapiens. Beyond that we don’t know, but fossil evidence shows that Australopithecines had much more pronounced sexual dimorphism than modern humans. That is evidence that they had a different social structure, perhaps along the lines of the gorilla.