The 33-year-old Swede, who captured his third Norris Trophy last season as the NHL’s best defender, had career highs of 25 goals and 76 assists in 82 games last season with San Jose — the most points by an NHL defenseman since Brian Leetch in the 1991-92 season.
Karlsson, who spent nine seasons with the Ottawa Senators and the past five campaigns with the Sharks, also won the Norris Trophy in 2012 and 2015 with Ottawa and was named top defenseman at the 2014 Winter Olympics in a silver-medal effort.
Pittsburgh also received forward Rem Pitlick, prospect Dillon Hamaliuk and a third-round 2026 draft pick.
The Penguins won 40 games last season but finished one point out of the playoffs in the Eastern Conference while Montreal was second-worst in the East with 31 wins.
San Jose won only 22 of 82 contests last season to finish third-worst in the Western Conference.