Barmes, who signed a two-year, $10.5 million deal Monday, played in 123 games for the Astros last season in his only year in Houston, but the Astros weren't in a position to re-sign him considering the club is going through a rebuilding phase.
The Astros could choose to find a shortstop through a trade or free agency or fill the void internally with Angel Sanchez, who played a part-time role last year, or Jimmy Paredes, who could be moved from third base, though the club is reluctant to do that.
Switch-hitting prospect Jonathan Villar is the club's shortstop of the future, but he's not likely to reach the Majors next year.
"We'll have to explore different options to find a front-line shortstop or someone to share time with Sanchez," Astros general manager Ed Wade said.
The Astros will receive a supplemental pick in next year's First-Year Player Draft for losing Barmes, who was a Type-B free agent.
Barmes, who was in Pittsburgh on Monday for a physical, said he chose the Pirates because they guaranteed him two years and he was able to reunite with manager Clint Hurdle, who was Barmes' manager in Colorado when he broke into the Major Leagues. It also appealed to Barmes that he could remain at shortstop.
"In talking with my agent and talking with the club, they were wanting to make a decision and they wanted to know by pretty much yesterday who their shortstop was going to be so they could continue to move on," Barmes said. "It was one of those things they had a few others guys lined up behind me, and the way it was explained to me, I was the first in line as far as who they wanted. They threw a great offer."
Barmes, 32, played a Gold Glove-caliber shortstop last season for the Astros, who acquired him last November from the Rockies in exchange for pitcher Felipe Paulino. Barmes missed the first couple of weeks of the season after breaking his hand in Spring Training and wound up hitting .244 with 12 homers and 39 RBIs.
"I definitely enjoyed my time in Houston," he said. "I know talking to Ed Wade and the plans for the club and different things, I hate to say that I didn't fit. But the direction they were heading made it hard. I enjoyed my time there, especially the people in the organization and my teammates, and I think they're heading in the right direction."
Barmes said Milwaukee also talked to him about a possible two-year deal, but the Brewers wanted to wait until the Prince Fielder situation played out before making an official offer. Fielder, a first baseman, is one of the biggest free agents on this year's market.
"We decided [Pittsburgh's] offer was too good to pass up," Barmes said.
Barmes was drafted by the Rockies in 2000 and spent his entire career in Colorado while battling several injuries along the way. He hit .254 with 61 homers and 285 RBIs in 665 games with the Rockies before being traded.