Marriage is a social reality more than a legal creation. The state recognises marriages which take place; it never suddenly decided “hey, let’s create this legal institution called ‘marriage’ which (nice, normal) heterosexual couples can enter into instead of just shacking up like they do now”. All the state does is to accept the fact that marriage exists as a social reality, and provide for legal consequences to flow from marriage.
This means they have to have some rules for courts and public officials to know when a couple is married. The main rule is a registration procedure; if you get married, you have to register with the state, so that the state knows you’re married.
In most jurisdictions that I’m familiar with, if you fail to register, you’re still married as a matter of social reality and as a matter of law. You’ve committed the offence of failing to register a marriage, but you’re married. If you go ahead and marry someone else, you’ll be charged with bigamy.
Apart from registration, the state has some other rules. They won’t recognise a marriage between two twelve-year olds, for instance, or between brother or sister. By and large, these rules follow community standards. Society doesn’t accept such relationships as marriages. Most or all churches will refuse to celebrate such marriages. And the state follows suit. There can be small mismatches between social reality and the state’s rules of recognition, or blurry boundaries, but no big mismatches.
So why would it even occur to the state to refuse to recognise a marriage on the grounds that the ceremony took place somewhere else? Society as a whole would never adopt this attitude. A married couple from, say, Germany who migrate to the United States have never, ever been expected to recelebrate the marriage in the US. The idea is preposterous, and probably offensive.
There is absolutely no reason why the state should adopt a policy of refusing to recognise socially-accepted marriages on the grounds that they were celebrated somewhere else. Polycarp’s point about comity is well made, but the reason that State A recognises marriages celebrated in State B is not because State B reciprocates; it is because recognising marriages celebrated in State B accords with the reality on the ground; the couple concerned really are married, and it would be an extraordinarily bad idea to pretend that they are not.
But State A will generally only recognise a foreign ceremony of marriage if it accords with State A’s concept of marriage. So a monogamous state will not recognise a polygamous marriage, and a state whose concept of marriage is exclusively heterosexual will generally not recognise a gay marriage celebrated abroad (any more than it recognsies a gay marriage celebrated within the state).