Sources told ESPN the deal also includes a fourth-year option for $13 million.
Gallardo, who turns 30 later this month, is 102-75 with a 3.66 ERA in nine major league seasons, the first eight coming with the Milwaukee Brewers.
Last year, pitching for the Texas Rangers, he went 13-11 with a 3.42 ERA, but struggled in the second half, posting a 1.72 WHIP and lasting six innings just twice in 14 outings. He made 33 starts, marking the seventh straight season in which he started at least 30 games and worked 180-plus innings.
As a result of signing Gallardo, who declined a qualifying offer from Texas, the Orioles must surrender the 14th overall pick in this June's amateur draft. Gallardo fills the void created by the departure of free agent Wei-Yin Chen, joining an all-right-handed rotation that currently features Chris Tillman, Miguel Gonzalez, Ubaldo Jimenez and Kevin Gausman.
The Orioles are also expected to sign outfielder Dexter Fowler, a move that would cost the team its second-round draft pick.
Fowler had been discussing a multiyear deal with the team in the range of $12 million to $13 million annually, for either two or three years, sources told ESPN The Magazine's Buster Olney earlier this week.
Information from ESPN's Jerry Crasnick was used in this report.