The Grizzlies, however, kept Mike Conley after discussing deals for their franchise point guard with multiple teams.
"Marc brings significant playoff experience to our team, which along with his savviness and leadership skills really helps position us for our ultimate postseason goal," Raptors president Masai Ujiri said Thursday night. "We look forward to welcoming Marc to our city and team."
Head coach Nick Nurse said he believes Gasol's experience will give the Raptors "a settling force" come playoff time.
"I think that there's a lot of positives with a guy like Gasol, and I think most of them come with being battle-tested," Nurse said. "I think we all know that those playoffs can get wild and woolly, and he's a guy that's been through them many times."
In a separate deal, the Raptors traded veteran center Greg Monroe and a 2021 second-round pick to the Brooklyn Nets in exchange for cash considerations. The Nets then waived the 28-year-old Monroe, who averaged 4.8 points and 4.1 rebounds in 11.1 minutes per game during his first season with the Raptors.
Gasol, 34, is averaging 15.7 points, 8.6 rebounds and a career-high 4.7 assists (which ranks second among NBA centers, trailing only Nikola Jokic's 7.7). He is the Grizzlies' franchise leader in points, rebounds, blocks and field goals made.
It is a power move for Toronto, as it looks to improve its roster as it vies with Philadelphia and Milwaukee, among others, in the Eastern Conference. The 76ers and Bucks also made major moves ahead of the trade deadline, with Philly landing Tobias Harris and Milwaukee getting Nikola Mirotic.
Gasol has been with the Grizzlies for 11 seasons, which was tied with Russell Westbrook for the fourth-longest tenure with one franchise among active players. Conley is third at 12 seasons.
A three-time All-Star and the 2013 Defensive Player of the Year, Gasol has a 15 percent trade bonus that is valued at $1.28 million. The amount of his bonus (if not waived) will be applied to his $24.1 million salary.
Gasol also has a $25.6 million player option for next season.
The 7-foot Valanciunas is averaging 12.8 points and 7.2 rebounds this season. He had surgery after suffering a dislocated left thumb on Dec. 12 and has not played since. Prior to the trade, the Raptors had expected the center to return against Atlanta on Thursday night, with the team tweeting out a picture of Valanciunas with a quote from him saying, "I'm back."
The 26-year-old Wright, who was selected by Toronto in the first round of the 2015 draft, is averaging 6.9 points, 2.2 assists and 2.6 rebounds in 18.3 minutes of action per game this season.
Miles, 31, is averaging 5.5 points and 1.7 rebounds this season.
Valanciunas, Wright and Miles can become free agents next season. Miles ($8.7 million) and Valanciunas ($17.6 million) have player options, while Wright will become a restricted free agent and is eligible to receive a $3.6 million qualifying offer in June.
Memphis is currently $668,000 below the luxury tax threshold.
Memphis also waived forward Omri Casspi to get its roster down to the NBA limit of 15. Casspi, 30, has been sidelined with a knee injury, and his return this season wasn't guaranteed. He averaged 6.3 points in 36 games with Memphis this season.
ESPN's Bobby Marks and ESPN Stats & Information contributed to this report.