On 13 September 2018, Karlsson (along with Francis Perron) was traded to the San Jose Sharks in exchange for Chris Tierney, Dylan DeMelo, Josh Norris, Rūdolfs Balcers, the Sharks' first-round pick in 2020, second-round pick in 2019 and a conditional second-round pick in 2021. He scored his first goal with the Sharks on 18 November in a 4–0 win over the St. Louis Blues. After a slow start to the season, Karlsson became the fifth defenceman in league history to have at least one assist in 14 consecutive games following a 7–2 victory over the Edmonton Oilers on 8 January 2019. On 23 December, Karlsson was suspended for the first time in his career for two games for an illegal check to the head of Los Angeles Kings player Austin Wagner. A groin injury resulted in Karlsson missing many games near the end of the season before returning for the last game of the season against the Colorado Avalanche. He would finish the season with 45 points in 53 games, his lowest point tally since the 2012–13 season. Karlsson assisted San Jose in reaching the Western Conference Finals during the 2019 playoffs, though he sustained another groin injury in a game against the St. Louis Blues, resulting in him missing San Jose's final game of the playoffs when the team lost 5–1 in Game 6. He would finish the playoffs with 16 points in 19 games. On 31 May, he underwent groin surgery.