Milwaukee will receive pitcher Phil Bickford and catcher Andrew Susac in return for the 27-year-old Smith, who is 1-3 with a 3.68 ERA in 27 appearances this season.
Smith tore a ligament in his right knee tying his cleats in spring training this year and started the season on the disabled list. He has been pitching with a brace.
He was dominant in 2015, striking out 91 batters in 61? innings.
Bickford, 21, the Giants' first-round pick (18th overall) in the 2015 draft, is 5-6 with a 2.71 ERA in 17 starts for two Class-A clubs in the Giants' system this season.
Susac, 26, was the Giants' second-round pick in the 2011 draft. He is batting .277 with eight home runs and 38 RBIs in 61 games in the Giants' minor league system this season. After hitting .364 in three games for Class-A San Jose, he was promoted to Triple-A Sacramento and has hit .273 with eight home runs.
Susac could provide the Brewers insurance in case they decide to trade catcher Jonathan Lucroy before the deadline.
Smith's going to San Francisco was first reported by Yahoo! Sports.