Houston sent right-handers Albert Abreu and Jorge Guzman to the Yankees. The Yankees are kicking in $5.5 million of the $17 million McCann will make in each of the next two seasons.
"It had to be the right fit," McCann said on a conference call. "It wasn't going to be just anywhere."
The Astros' busy day also included the signing of free-agent outfielder Josh Reddick to a deal that is reportedly for four years and worth $52 million. In Reddick, the Astros get a steady glove in right field, who in 155 combined games last season between the A's and Dodgers hit .281 with 17 doubles, 10 home runs and 37 RBIs.
McCann is a seven-time All-Star, but his playing time diminished in the second half of the season as rookie Gary Sanchez emerged as a power hitter behind the plate. Sanchez hit 20 home runs in just 53 games.
The 32-year-old McCann hit .242 with 20 homers and 58 RBIs this year.
"We entered the offseason with the acquisition of a catcher as a primary focus," Astros general manager Jeff Luhnow said in a statement.
"Brian McCann is a great fit for the Astros as he is not only a good defensive catcher, he is also a left-handed hitter with proven run-producing ability," Luhnow said. "His experience and his ability to impact his teammates will be a significant benefit to our team."
Jason Castro made the most starts at catcher for the Astros last year, batting .210 with 11 homers and 32 RBIs.
Houston and the Yankees met in the AL wild-card game in 2015, but neither team reached the playoffs this year.
McCann made his big league debut with the Braves in 2005. He hit 24 homers the next year and has hit at least 18 home runs in every season since then.
McCann has 245 career homers with 888 RBIs while batting .266.
This was McCann's third season in New York after signing an $85 million, five-year deal as a free agent. The Yankees had a $15 million option for 2019 with no buyout.
"I wanted to catch every day," he said. "I feel like I still have a lot of good years left."
McCann likes what he sees in the Astros, praising "a lot of great young pieces."
"I wanted to be a part of it," he said.
The 21-year-old Abreu was a combined 3-8 with a 3.72 ERA for two teams in Class A. The 20-year-old Guzman was a combined 3-4 with a 4.05 ERA with two rookie-level teams.
The Yankees signed McCann in the winter prior to the 2014 season, with a full no-trade clause. McCann is entering the fourth year of the contract.
The deal includes a vesting option that, in theory, he will now have a better chance of achieving. If McCann has a total of 1,000 plate appearances combined in 2017-18 and he plays 90 games at catcher in 2018, while avoiding the disabled list, he would add another $15 million for 2019.
With the Yankees, it would seem unlikely he would reach those goals, unless Sanchez underperformed or were injured. With McCann gone, the Yankees have catchers Austin Romine and Kyle Higashioka as possible backups to Sanchez on the 40-man roster.
Information from The Associated Press, and ESPN's Buster Olney and Andrew Marchand was used in this report.