Without even a winning record since their last trip to the postseason in 1992, the Pirates trail the Reds by 2½ games in the NL Central and are in the thick of the wild-card race. They have been looking to bolster the back end of their solid rotation that is led by A.J. Burnett and James McDonald.
Rodriguez provides Pittsburgh with another arm.
The Pirates will get up to $17.7 million in the deal to offset what could amount to over $30 million in salary for Rodriguez.
They are sending Triple-A All-Star Rudy Owens and Colton Cain, both left-handers, and outfielder Robbie Grossman to Houston.
"We talked since Day One of the trading season about wanting to improve our club either via pitching or via hitting," Pirates general manager Neal Huntington said. "The pitching market turned out to be more flexible than the hitting market and we decided this was the right move for us."
The only player on the Astros roster remaining from their 2005 trip to the World Series, Rodriguez has been a steady presence on a rebuilding ballclub that has the worst record in the majors this year and lost 106 games last season.
He made his way through Houston's dugout during the fifth inning of Tuesday night's game against the Cincinnati Reds, shaking hands and hugging his teammates. He looked somber and his eyes were red-rimmed as he said his goodbyes.
"Wandy represents a lot of good memories for Astros fans and for Houston and will certainly be bittersweet for everybody involved," Astros general manager Jeff Luhnow said. "We look forward and look to the future and want to do everything we can to improve this ballclub at all levels."
Signed by the Astros in 1999, he is 80-84 with a 4.04 ERA in eight seasons. Rodriguez is 7-9 with a 3.79 ERA this year.
Pittsburgh manager Clint Hurdle believes Rodriguez will be helped by a change of scenery.
"I'm sure a change of clubhouses for him, a change of the dynamic of being in a situation (a pennant race) he hasn't been in for three or four years should be helpful," Hurdle said. "I've prepared for him for many years as a manager and as a coach. He has also been a tough pitcher to hit, a tough pitcher to beat. I'm very happy that we're adding him to our rotation."
The Astros rewarded Rodriguez with a three-year, $34 million contract before the 2011 season. And Houston will pay $1.7 million of the approximately $3.4 million on left on Rodriguez's contract this year. The Astros also are scheduled to pay $8.5 million of his $13 million salary next season.
A $14 million team option for 2014 became a player option with the trade, and Houston would be responsible for $7.5 million should Rodriguez choose to exercise the option.
The 33-year-old Rodriguez's salary is a big addition for the team with the 26th lowest payroll in baseball at the start of 2012 at $63,432,000.
The Astros began the season with a $60,651,000 payroll. But after trading Rodriguez, Carlos Lee, Brandon Lyon, J.A. Happ and Brett Myers, Jed Lowrie makes the most on the 34-64 ballclub at $1.15 million.
"It's been rough for the past couple of years and we're doing everything we can to hurry it up so we can get back to those types of years," Luhnow said.
Owens is 8-5 with a 3.14 ERA in 19 starts for Triple-A Indianapolis. He has 85 strikeouts and only 25 walks in 117 1/3 innings. Owens, a 28th-round selection in the 2006 draft, will be placed on the Astros' 40-man roster.
The 22-year-old Grossman was hitting .262 with 20 doubles, seven home runs and 35 RBIs in 94 games for Double-A Altoona. Baseball America ranked him as the Pirates eighth best prospect. He was a sixth-round pick in 2008 out of Cy-Fair High School in Houston.
Cain, 21, is 3-5 with a 4.20 ERA in 16 starts for Class A Bradenton. An eighth-round pick in 2009, Cain is a graduate of Waxahachie High School in Texas.