The Sharks announced in June that Nabokov would not be offered a new contract.
SKA St. Petersburg is one of the top teams in the Continental Hockey League (KHL).
Club chairman Alexander Medvedev confirmed the signing in comments on the club website, but declined to say how much Nabokov would be paid. Reports in several media outlets have put the deal's value at $24 million.
Nabokov, who will turn 35 later this month, made $6 million in his final season with the Sharks.