The modern definition of "marriage" is rooted from the Latin 'maritare', which not only means to marry but also inherits the idea of procreation. 'Maritare' was originally used as a term to 'marry' plants together, referring to the grafting of plant stems. Naturally, this process was done for the purpose of propagating plant lineages. Marriage therefore, established a means to pursue morally permissible options of sex and procreation. .
Back in the day, with no truly effective means of protection, childbearing would definitely have ensued from sexual intercourse between a man and woman. However, raising a child would require commitment and self-investment to its highest level. Therefore, a legal contract of marriage was needed to bind individuals in commitment to one another to take into serious consideration the responsibility of raising a child. The only means to prevent it was to practice abstinence, which was the primary form of contraception at the time. Hence, I would say that marriage at its core was a contract to 'guaranteed sex'. .
Over the years however, several products have been made available in the market to practice sex. Unlike former years, individuals do not need to restrain themselves from engaging in sexual pleasures, since pregnancy has become preventable. Means of protection have removed the earlier prohibitions on premarital sex, which were further stigmatized by religious powers, and has somewhat normalized it amongst the prevailing culture. Hence, sex today is practiced amongst multiple partners, unlike the monogamous dynamics practiced earlier. I can infer that this is due to the removal of the onus on having to raise children in consequence of every affair that an individual chooses to have. Hence, the intention of preventing premarital sex, has shifted a step ahead to preventing premarital pregnancy. The latter notion still remains due to reasons mentioned earlier.