TL/DR; Monogamous marriage is not compulsory, but it makes a better more peaceful society.
I believe there is a better way to frame your question. Instead of asking why marriage is compulsory (in what sense?), I think you're asking why do people culturally agree to the idea of marriage when we as humans by nature do not need marriage for the purpose of procreation.
Biologically, all it takes is a male and female to copulate to create an offspring.
The term you are looking for is "Enforced Monogamy", where the idea of having more than one sexual partner is frowned upon by society. Monogamy is not an mainstream idea until very recently with the rise of modern civilized society, recent being the last few thousand years of course. When comparing to the millions of years in the history of Homo Sapiens, and the approximately 1 hundred thousand year history of the biologically modern human.
Paleo/Neolithic human society have operated in a way that the stronger males have greater access to sexual partners whereas the bottom rung lives their whole lives never having sex with a female. At the same time it is the norm of the females to have multiple sexual partners. The ancient African proverb of "It takes a village to raise a child" was literal back then. Mothers at the times believed that having multiple sexual partners would make sure her child gains all the positive traits of their "fathers". Of course we today know that it is not correct, like so many superstitions of the time. But it sheds a light of how their societies works. And there is a correlation to how they are much more violent to one another.
A hyper/polygamous society is proven to be more internally violent than monogamous ones. It only makes sense, since males would have to fight to the top to assert their dominance and ensure they have more chance in having sex and passing their genes. We've been like this for as long as our species can remember, until we slowly realise over the course of thousands of years that by enforcing a society where every human gets a fair chance at having children, we can build a better society where humans do not need to fight for sex and so can dedicated their time to other enterprises that further the human society.
We see time and time again that the most violent societies as a whole are ones that practices polygamy. The Vikings, the Mongols, cannibalistic tribes, the likes. Whereas societies that thrived are ones that usually practiced monogamy as a whole.
There is so much to be said and debated over the issue of marriages, It is a wide ranging anthropological, sociological, political discussion that i am nowhere near being an expert.
But I do recommend the book Sapiens by Professor Yuval Noah Harrari, which i thoroughly enjoyed and formed the basis of my understanding and argument of the issue to your question.
Is marriage compulsory? I don't not think so. I am yet to see any law which says it's citizens must marry. Even the holy book never made marriage compulsory but only admonished.
It is undeniable that there are so many benefits of being married but still that doesn't make it compulsory. It is more it is expedient but not a law. If you marry, well, two good heads are better than one then there is procreation and legal satisfaction of sexual urges.
It is important to marry and procreate so the human race can continue but it is not binding on anyone. If it is a law in some countries, I would love to read about it.
Marriage is not compulsory and no legal law states that it is compulsory but there are some cultures or traditions that feels marriage is compulsory and those people from such cultures or traditions must get
married someday because if they do not get married then it will be considered as a taboo,,but i believe that marriage should not be compulsory,people should be
allowed to go into marriage based on their own personal decisions,,people should not be forced to get married,,i think one of the major cause of high rate of
divorces is the fact that many people who were not ready for marriage or love each other are now forced to get married to each other because they do not want to
be condemned by the society for not being married at a certain age,i think such mentality needs to stop and people should be allowed to have their own decisions to take in life...
Allah Ta’ala berfirman:
وَأَنْكِحُوا الْأَيَامَى مِنْكُمْ وَالصَّالِحِينَ مِنْ عِبَادِكُمْ وَإِمَائِكُمْ إِنْ يَكُونُوا فُقَرَاءَ يُغْنِهِمُ اللَّهُ مِنْ فَضْلِهِ وَاللَّهُ وَاسِعٌ عَلِيمٌ
"And marriage is the people who like you, and those who are worthy (mating) of your male servants who are male and your servants who are women. If they are poor God will enable them with His grace. And Allah is knowledgeable (His gift) is the Knower "(Surat an Nur: 32).
In this verse there is an order to get married. Even the ulama disagree to marry which is mandatory or is the sunnah to be 3 members:
The School of Dhahiri believes that the law of marriage is mandatory, and the unmarried person is sinful. They postulate with the above verse, which uses the command sentence وَأَنْكِحُوا (and marry it ...) and the order shows the mandatory law.
They also said that getting married is a way to keep yourself from being haram. And the rule says:
ما لا يتم الواجب إلا به فهو واجب
"Imperfect obligations except with something, then something is mandatory"
Syafi'i School of thought argues that the law of marriage is mubah, and the unmarried person is not sinful. Imam Asy Syafi'i said that marriage is a means of channeling lust and achieving the pleasure of lust (the lawful), then the law is changed just like eating and drinking.
The opinion of the ulum jumhur, namely the Maliki school, Hanafi and Hambali argues that the marriage law is mustahab (sunnah) and not until mandatory.
They postulate with the following points:
ولا تُنْكَح الثيب حتى تستأمر
read more here : https://muslim.or.id/25059-apakah-menikah-itu-wajib.html
Is it really compulsory? Then my life must be inconsequential 😿