Philadelphia will receive minor-league pitcher Enyel De Los Santos in the deal.
Galvis has been Philadelphia's starting shortstop for the last three seasons and has emerged as one of the sport's top defensive players at the position. He batted .255 with 12 home runs, 61 RBIs and 14 stolen bases this past season, his sixth overall with the Phillies.
Galvis, 28, is eligible to become a free agent after the 2018 season. The trade likely will open up an opportunity for top prospect J.P. Crawford to become Philadelphia's starting shortstop.
De Los Santos, who turns 22 on Dec. 25, went 10-6 with a 3.78 ERA in 26 games -- 24 starts -- for Double-A San Antonio in 2017.