Karlsson had the procedure May 31 to repair a groin injury, and the Sharks said the defenseman is expected to be ready for the beginning of next season.
Karlsson was a key contributor for the Sharks during the postseason. He had 16 points (two goals, 14 assists) in 19 playoff games, but didn't play when the St. Louis Blues eliminated San Jose in Game 6 of the Western Conference finals on May 21.
The 29-year-old defender missed 27 of the Sharks' last 32 regular-season contests with groin injuries. He had 45 points (three goals, 42 assists) in 53 games.
"I was very fortunate to be able to play pretty much all the games, except the last one, in the playoffs at a reasonable level, even for my standards. I think that's great," Karlsson told reporters. "Everybody is dealing with something. You have to play through things. I was able to do that. For that, I'm proud and grateful.
"It's nothing major. It's just going to take some time and figure everything out. It should be something that's easy to deal with. That's as much as I know."
Karlsson, who was acquired by San Jose in a trade with the Ottawa Senators on Sept. 13, can become an unrestricted free agent July 1.