Escobar, 32, had 22 home runs for the last-place Diamondbacks and made his first All-Star Game this season. He can play any infield position, and is likely to see time at third and first base. The Brewers have Willy Adames and Kolten Wong playing shortstop and second base, respectively.
The switch-hitting Escobar has a career .778 OPS in 11 seasons, the past four with Arizona. It's the third in-season trade to net the Brewers an infielder, as they previously acquired Adames from the Tampa Bay Rays and first baseman Rowdy Tellez from the Toronto Blue Jays.
"We're talking about a very accomplished switch-hitter. He has tremendous positional versatility. He can play all over the field, infield and outfield. He gives us a lot of options," Brewers president David Stearns said. "One of the things we're trying to accomplish prior to the 30th is preparing ourselves for the unknown of what can happen over the next two months. ... Redundancy everywhere is really important."
Escobar said it was tough to leave Arizona but it was exciting to have an opportunity to be in the postseason hunt.
"I love this team. I have really good people here, really good friends," Escobar said of the Diamondbacks. "But at the end of the day, it's a new opportunity for me. I'm so happy that the organization in Milwaukee is giving me an opportunity to help this team win. You saw me every day here playing really hard. I'll do the same thing over there."
Milwaukee is sending back prospects Cooper Hummel and Alberto Ciprian to complete the deal.
Hummel, 26, was an 18th-round pick for Milwaukee in 2016 and is currently at Triple-A, where he's slashing .254/.435/.508. He has played first base, catcher and the outfield for Nashville.
Ciprian, 18, signed as an undrafted free agent with Milwaukee in 2019 and was playing in the Dominican Summer League, averaging .378 while adding eight RBIs in his first 12 professional games.
"We're happy with the two players we got from the Brewers," Arizona general manager Mike Hazen said. "I think anytime we're trading someone like Eduardo off our team it's certainly bittersweet. But given the position we're in right now, it made sense for us to do so."
The Diamondbacks had been expected to move him for weeks, and Escobar was highly sought-after, with the Chicago White Sox also interested in his services. However, Milwaukee has just as big a need for him. The Brewers rank last in batting in the National League, hitting 21 points lower as a team than Escobar's .246 batting average.
Escobar is in the final year of a $21 million, three-year contract.
Information from The Associated Press was used in this report.