Reimer, who can become an unrestricted free agent on July 1, was having a solid season for the rebuilding Leafs with a 2.19 goals-against average and .918 save percentage.
Th 27-year-old Reimer, who has 207 games of NHL experience, will back up starter Martin Jones in San Jose. He will be an upgrade over the struggling Alex Stalock, who was sent to the Maple Leafs along with forward Ben Smith and a fourth-round pick in 2018.
The Sharks also got forward Jeremy Morin from Toronto.
The Associated Press contributed to this report.