San Jose also acquired a fifth-round pick in 2010 and sent a 2010 second rounder that previously belonged to Carolina to complete the deal.
"Niclas is a playoff-hardened, veteran player with lots of postseason experience and a Stanley Cup ring," Sharks general manager Doug Wilson said. "Good, solid character players are hard to come by and we think he will complement our existing group very well. He has a history of playing his best when the games mean the most."
The Sharks had been looking to add experience to the blue line after shuttling defensemen back and forth from Worcester of the AHL for much of the season. The need became even greater with Marc-Edouard Vlasic sidelined with a lower body injury.
The 34-year-old Wallin, who will be an unrestricted free agent after this season, has spent all nine of his NHL seasons with Carolina, with 18 career goals and 51 assists. He played in 69 playoff games, the second-most in club history, helping the Hurricanes reach the Stanley Cup finals twice, winning it in 2006.
"I want to win. I want to win championships," Wallin said. "This is obviously one of the best teams in the league and they've shown it for years now. I'm excited to be a piece of this puzzle."
He developed a reputation for scoring overtime goals in the playoffs: All three of his career postseason goals came in extra sessions, and he even "blessed" defenseman Tim Gleason's stick before Gleason's OT game-winner in Game 2 of last year's first-round series with New Jersey.
He has five assists and 26 penalty minutes in 47 games this season and ranks 15th among all NHL defenseman with 125 hits.
"I try to play a simple game," he said. "I like to play a physical game. I like to close the gap and go down low and play aggressive in our own end. That's probably how I play the game."
The deal sends Wallin from a team tied for last place in the Eastern Conference to the top team in the West. The Sharks lead the Western Conference with 85 points. The Sharks won the Presidents' Trophy for the best regular-season record in the league a year ago before being eliminated in the first round of the playoffs by Anaheim.
"This is like winning the lottery," Wallin said. "You get to play on a team that obviously has a chance to go all the way. I've been there and there's nothing like it. This team has every tool to do it."
The Sharks wanted to make this deal before rosters were frozen for the Olympic break beginning Feb. 15. There are only three days after the break until the trade deadline, leaving little time to get a deal done.
Wallin is expected to make his debut for the Sharks on Monday night in Toronto. San Jose has four games before the break.
Wallin played with Sharks defender Douglas Murray on the Swedish national team at the 2008 world championships and hopes that will help the transition.
"He's going be a big help for me coming over there, giving me some pointers," Wallin said. "It's always an easier thing when you have a guy from the same country. The first couple of weeks he can give me some pointers."
AP Sports Writer Joedy McCreary in Raleigh, N.C., contributed to this report.