What’s the point of marriage?

I get it everyone wants companionship or whatever the case might be but why can’t you just be with someone forever or for however long without signing a contract with the state? I’ll never understand this.