Since the late 1800s, the Supreme Court has treated marriage as a fundamental right both as part of the pursit of happiness and liberty (the right to enter a contract). The most important case was Loving v. Virginia, where the Supreme Court ruled that states cannot ban interracial marriages.
Supreme Court cases on racial discrimination have already been applied to other minority groups, such as gender discrimination. Basically, the government cannot deny a right to a group unless they can show a reason for that policy under the rational basis review, the 14th amendment. In the gey marriage case in California, the groups against gey marriage failed to reach this standard.