Baltimore gave Arizona right-handed reliever Matt Lindstrom and cash considerations or a player to be named later.
Saunders, who was scheduled to start Sunday against San Diego, was 6-10 with a 4.22 ERA in 21 starts with Arizona this season. He won 12 games last season while helping the Diamondbacks win their first NL West title since 2007.
Baltimore began the day tied for the second American League wild-card spot with Oakland and in third place in the AL East, only four games behind the division-leading New York Yankees.
"I like our ballclub's chances," said Dan Duquette, the Orioles vice-president of baseball operations. "There's an old saying: If you're going in the right direction, keep walking. So the addition of Joe Saunders gives us a chance to keep walking in the right direction. And I think it gives us better balance against the left-handed lineups that we're going to be facing."
Saunders was born in nearby northern Virginia, played high school ball in Virginia and pitched at Virginia Tech before being drafted in the first round of the 2002 draft by the Los Angeles Angels.
"We've liked Joe Saunders for quite a while," Duquette said. "We had some discussions with him in the off-season. He's a local kid and a professional left-handed pitcher. He's won more than he's lost in the big leagues, he's pitched in the American League, he's pitched in the playoffs. He's pitched in a tough ballpark in Arizona."
The Orioles have only one left-hander in the bullpen and a rotation that includes rookies Miguel Gonzalez, Wei-Yin Chen and Steve Johnson.
"We just liked his experience, which I think compliments our starting rotation," Duquette said of Saunders. "And I also like the fact he's left-handed."
Saunders, 31, has pitched for the Angels and Diamondbacks since launching his big league career in 2005.
"I just like this addition of veteran left-handed depth to our staff," Duquette said. "It helps solidify the starting rotation while we're waiting for (injured) Jason Hammel to return. Then, if Jason Hammel does return, it gives us another good left-handed option because Joe Saunders is very good left-on-left. While we're waiting for (left-handed reliever Troy) Patton to come back, if we have several starters doing well, Joe gives us more depth and experience to our pitching staff."
Lindstrom went 1-0 with a 2.72 ERA in 34 appearances with the Orioles this season. He has held right-handers to a .207 average and scoreless in 10 of his past 11 outings.
Lindstrom has played six major league seasons with Miami, Houston, Colorado and Baltimore.
"He's another right-handed power arm. He's got some experience here in the West as well. We're pretty familiar with him, and you can see we like power arms in our bullpen, so he'll be a good addition," Arizona manager Kirk Gibson said.
Duquette believed Saunders would be more valuable to the Orioles than Lindstrom at this point in the season.
"Matt Lindstrom did a nice job for us. He contributed to the bullpen," Duquette said. "I just think the left-handed addition to our starting rotation and the capability to get more innings at a high level was better for the team at this stage of the season. And who knows? Joe Saunders is a local kid. Maybe he's with us beyond this year. That's something we can take a look at. It certainly strengthens us now."
To fill Lindstrom's place on the 25-man roster, the Orioles recalled right-hander Jake Arrieta from Triple-A Norfolk. Arrieta, Baltimore's opening day starter, went 3-9 with a 6.13 ERA in 18 starts with the Orioles before being optioned to Norfolk on July 5.
The Diamondbacks had talked about going to a six-man rotation so they could keep rookie Tyler Skaggs in the big leagues, but went in a different direction. With Saunders gone, Skaggs has his spot.
Arizona general manager Kevin Towers said the trade had a lot to do with the team's young pitching. Skaggs, Patrick Corbin and Wade Miley are all rookies, while Trevor Cahill and Ian Kennedy are the only ones left from the opening day rotation.
AP Sports Writer John Marshall contributed to this report.