Well it depends on your circumstances. If you have more money/assets than your partner, it may not be to your advantage to marry.
But often what happens is that the woman, if unmarried, moves in with the man. She often contributes to the mortgage but her name isn’t on it. Therefore she is paying off her partner’s debt yet has no claim on the house.
She then has children, and loses income when on maternity leave and beyond because she goes part time or becomes a stay at home mum. Pension contributions reduce or stop. Meanwhile the partner carries on working as usual.
Then the relationship breaks down, and all of a sudden the woman has no home, no claim on the house (despite paying towards it and allowing her partner to continue working by looking after his children). She has no access or right to savings or investments or pensions in his name.
Whereas if they’d been married, she would legally have a claim on the house, savings, pension, usually starting with an assumed 50/50 split.