My wife and I have been together over 30 years, and married for more than 26 years.
We did legalize our union, but I do not think that that is necessary, or even central. And, of course, sometimes, it is impossible, if the couple (or group) coming together does not fit the local definition of people who are allowed to make a legal union. My wife and I are committed to lifelong monogamy, but one of the strongest families we know has three adults.
The "secret" of a long-term loving relationship is really quite simple: Work! Commitment to work on ourselves, to eliminate all that is not loving within ourselves, so that we act steadily out of love towards the other. Commitment to work to heal our weaknesses, so we are independent and fulfilled. Each person should be his or her own cake - and let the partner be the icing!
I don't usually express disagreement with other answers, but my own experience does not match what DashingScorpio says. My wife and I have been together for 30 years. Many of those years have been deeply painful. We have often wondered if we chose the wrong mate. And we've learned it doesn't matter. We chose to love one another, and each day we choose it again and again. Now, all that is required is that we learn how to love, and do it. Stephen Covey put it this way: Love is a verb. Do it, and the feeling will follow. Bad matches can be made good. Difficult circumstances can be transformed. Misunderstandings can stop mattering. Gratitude and love can win out in the end.
One view of spiritual marriage is that we ask for love, and yet God knows that what we need is to learn to love others. So he puts two people together who are the hardest people in the world to love. I'm a project manager; my wife is disorganized. My wife is spontaneous; I need plans to feel safe. We don't understand one another. We didn't get along at all.
And now it is all resolved in unconditional love.
My wife is here now, and agrees with all of this. A first! :) She adds - and I agree - that it works when both people are dedicated to making it work. If I am dedicated, and the other is not, then the choice is either patience, or a peaceful ending. We each chose to be patient through the other's doubts until Love won out.