In return, the Royals received pitchers Ryan Bergert, San Diego's No. 7 prospect, and Stephen Kolek.
Check out our MLB Trade Deadline tracker here for all trade updates.
Fermin is slashing .255/.309/.339 with three home runs and 12 RBI in 67 games for the Royals this season. The 30-year-old will now be a solid addition to a Padres team looking to make a World Series run this season.
Fermin is on a one-year deal but has four more years of arbitration up until 2029.
Bergent has seen playing time in the majors this season. The 25-year-old rookie has tossed a 2.78 earned run average in 11 games (7 starts) with the Padres, with 34 strikeouts and 18 walks in 35.2 innings, giving up 11 runs on 24 hits.
Meanwhile, the 29-year-old Kolek has a 4.18 ERA in 14 starts this season. Kolek has given up 37 earned runs on 78 hits through 79.2 innings, striking out 56 and walking 26.