According to recent polling, a majority of Americans think same-sex marriage should be legal, while a majority of Republicans think it shouldn't. In a two-party system with primaries, 35% of the general population is just about where you want your opponents to be on any issue. At that percentage, Republican politicians will find that it's easier to win primaries if they oppose same-sex marriage, since opposition is the majority view among Republicans. And then those politicians will be in trouble against Democrats in the general election, where support is the majority view.
It's obviously much better for your party to have majority support among the public on issues, but in some ways it's okay if some issue position is favored by only 5% of voters, all of whom are in your party. Then there aren't enough of those voters to control your primaries, so your party can still nominate people who don't have massive disadvantages in the general election. You run the risk of losing that 5% if that's their only issue, but the hope is that you can make it up to them on other issues. They may also realize that their view is in the minority, and that more work needs to be done before they can expect a major party to push it forward. Being at 35%, meanwhile, just sets you up to nominate politicians with the unpopular view who then lose general elections. You can hope to appease general election voters with other stuff, but the unpopular view is going to be a constant liability, and your opponents will do whatever they can to raise its salience.
It'll be interesting to see whether the Republican Party can become a majority supporter of same-sex marriage, or at least make opposition a less powerful force. Maybe there's some way the party leadership can de-emphasize the issue in primaries. Or maybe the general demographic and cultural trends leading to increasing majorities in favor of same-sex marriage will soon lead to majority Republican support.
But this won't be easy. The contemporary Republican party isn't built for maneuverable abandonment of long-held and long-reinforced positions. There will be TV and radio hosts ready to castigate Republicans who break from party orthodoxy, and they've already developed a rich enough parallel worldview among their audience that reconnecting the party faithful with political realities is going to be hard. Until they solve this problem, Democrats will benefit.
The Republican Party's problem isn't a problem for gay and lesbian couples who want to get married. The Supreme Court has made same-sex marriage legal across America, and that isn't going to change. So the substantive question is settled, and for that it doesn't matter how long the Republican Party sticks with the losing position. The interesting political question is whether Republicans can quickly amputate their gangrenous appendage, or whether it'll keep hurting them in election after election.