Romney was never for gay marriage. Even in 1994 he told the LCR that he would not support gay marriage or gay civil unions.
Then why was signed into law while he was gov?
As governor Romney proposed a compromise on civil unions.
He of course withdrew it rather quickly.