The SCOTUS can not write law. But they CAN rule on the constitutionality of laws. And that is what they did. They ruled that the laws forbidding same sex marriage were unconstitutional. Without those laws, same sex marriage is legal.
So how do states get away with denying drivers licences to blind people?
Denying a driver's license to a blind person is rationally based and pursues a proper legislative end – denying same-sex couples access to marriage law simply because they're gay is not rational, failing to pursue a proper legislative end.
There's also no Constitutional right to drive, there is a Constitutional right to marry.