The Yankees announced the trade during Thursday night's game against Boston.
The 26-year-old right-hander is 4-10 with a 5.13 ERA in 20 games for the Padres, including 19 starts.
Gaudin did especially well in late July, giving up three earned runs or less in five straight starts.
He could fill a couple of roles for the Yankees, either in long relief or as the No. 5 starter. Sergio Mitre has been shaky since becoming the fifth starter after the All-Star break.
Gaudin is 32-35 lifetime with two saves and a 4.58 ERA with Tampa Bay, Toronto, Oakland, the Chicago Cubs and San Diego since 2003.