The Yankees also got international signing bonus pool money from St. Louis in the deal announced Saturday night.
The Yankees, chasing AL East-leading Boston, needed to clear a roster spot to make room for Happ.
"I knew we had to make the move. I just didn't know what it was going to be. I prepared myself for it," Shreve said.
"I love it here. These are my friends. I've been here four years," he said. "I'll have a good opportunity over there. I'm going to miss these guys, a great group of guys."
The 28-year-old Shreve pitched 40 times in relief this season, going 2-2 with one save and a 4.26 ERA. The lefty gave up a run in the Yankees' 10-5 loss to Kansas City in the opener of a day-night doubleheader Saturday.
The 26-year-old Gallegos pitched four times for the Yankees this year, earning one save, and spent of the season at Triple-A. He will be assigned to Triple-A Memphis.
Voit was 2 for 11 with one home run and three RBI in eight games for St. Louis. The 27-year-old had mostly been in Triple-A this year.