San Jose confirmed it sent forwards Chris Tierney, Rudolfs Balcers and Josh Norris and defenseman Dylan DeMelo to the Senators, along with a conditional 2019 second-round draft pick and a conditional 2020 first-round selection.
If the Sharks re-sign Karlsson, the Senators will also receive a 2021 second-round pick. San Jose acquired forward prospect Francis Perron as part of the deal as well.
TSN's Pierre LeBrun first reported the trade.
Sharks general manager Doug Wilson said the following about Karlsson's acquisition, per the Sharks' official website:
"It's extremely rare that players of this caliber become available. The word 'elite' is often thrown around casually but Erik's skill set and abilities fit that description like few other players in today's game. With Erik, Brent Burns and Marc-Edouard Vlasic, we feel we have three of the NHL's top defensemen and stand as a better team today than we were yesterday. We are thrilled to welcome Erik and his wife, Melinda, to San Jose.
"Ultimately, to acquire a player like this, you have to give to get and we are losing some quality players but also some very good people. All of the players leaving our organization have a very bright future in this league and we wish them all the best."
Karlsson spent nine seasons with the Sens, developing into one of the NHL's premier blueliners after Ottawa selected him with the No. 15 overall pick in the 2008 NHL draft.
The Swedish rearguard's 2017-18 campaign was a down year by his standards, though, with nine goals and 53 assists for 62 points, along with a minus-25 rating.
Perhaps the biggest driving force behind Ottawa's decision to trade Karlsson was the fact that he has just one year remaining on his contract.
If Karlsson hits the open market, he figures to command the largest contract signed by a defenseman in NHL history.
The 28-year-old has twice won the James Norris Memorial Trophy, which is given annually to the NHL's top defenseman.
He is also a five-time All-Star and the No. 3 point scorer in Senators franchise history, with 518 points.
Karlsson has registered 70 or more points in a single season on four occasions, with his best campaign coming in 2015-16, when he finished with 16 goals and 66 assists for 82 points.
He has also enjoyed some playoff success, with 37 points in 48 career postseason games.
The Senators fell one win short of the reaching the Stanley Cup Final in 2016-17, and Karlsson was key to their run, recording 18 points in 19 games.
Ottawa experienced a huge drop-off last season, and with no new contract in place, it gave the Sens a reason to consider moving their captain.
It will be nearly impossible for Ottawa to replace what Karlsson brought to the table in terms of offensive punch, but trading him before his contract year is the best way to maximize the return value.
Losing Karlsson for nothing in free agency was a possibility, and trading him at next season's deadline may not have netted as strong of a return package.
The trade is an indication Ottawa is looking beyond 2017-18 and that the Sharks are serious about making a Stanley Cup run next season.
In San Jose, Karlsson will join forces with another of the NHL's top offensive defensemen in Burns, giving the Sharks perhaps the most potent blueline in the league.
After losing in the second round of the playoffs last season, the Sharks may have gotten what they need to return to Stanley Cup contention.