Gordon, 29, will be converted to the outfield by the Mariners after being Miami's second baseman.
"Dee provides us with a dynamic presence at the top of our lineup," Seattle general manager Jerry Dipoto said in a statement. "He's a two-time All-Star and former National League batting champion who is electric on the basepaths, having already won three stolen base titles. His athleticism will be an asset both in our lineup and in the middle of our outfield for several seasons to come."
Gordon batted .308 and led the majors with 60 steals last season. He was the NL batting champion in 2015 when he batted .333 with 58 steals.
Gordon has a career batting average of .293 with 11 homers, 161 RBIs and 278 steals during parts of seven major league seasons. He was with the Los Angeles Dodgers from 2011-14 before being dealt to the Marlins in a seven-player deal.
Gordon is slated to make $10.8 million this season as part of a five-year, $50 million deal. The pact includes a $14 million club option for 2021.
Gordon served an 80-game suspension in 2016 for violating MLB's performance-enhancing drug policy.
The Marlins received right-handers Nick Neidert and Robert Dugger and infielder Christopher Torres for Gordon. Meanwhile, Seattle also received an unspecified amount of international slot money.
Niedert, 21, was rated the No. 2 prospect in the Seattle organization by MiLB.com. He went 11-6 with a 3.45 ERA in 25 starts last season while splitting time at Single-A Modesto and Double-A Arkansas. Neidert was a second-round pick in 2015.
Dugger, 22, went 6-6 with a 2.75 ERA while splitting time between Single-A Clinton and Modesto. He was an 18th-round pick out of Texas Tech in 2016.
Torres, 19, batted .238 with six homers and 22 RBIs in 48 games for Short-A Everett last season. He was originally signed as an international free agent in 2014.
The Mariners are in the running for Japanese two-way player Shohei Ohtani, which is part of the reason why they coveted the international slot money as part of the deal.
The Marlins are in cost-cutting mode under new ownership and are also expected to soon deal reigning National League MVP Giancarlo Stanton.