The Braves sent left-handed pitcher Chris Jones to the Orioles. Jones, 24, was pitching at Double-A Mississippi.
Ayala, 35, was 5-5 with one save in three chances and a 2.64 ERA in 66 games with the Orioles in 2012. He had a 2.09 ERA in 52 games with the Yankees in 2011. Ayala is 1-0 this season, allowing two runs in two innings with Baltimore.
Ayala restores experience and depth to an Atlanta bullpen that is expected to be without left-hander Jonny Venters for at least another month. Venters was shut down on April 2 after receiving an injection in his sprained left shoulder.
Venters, on the 15-day disabled list, had been one of the team's top setup men for closer Craig Kimbrel. Venters received the injection after he was examined by Dr. James Andrews, who performed ligament-replacement surgery on Venters' elbow in 2005.
Braves general manager Frank Wren said he would have traded for Ayala even if Venters was healthy.
''Even if we had Jonny Venters on our club right now, I think this is still a move we would have made,'' Wren said. ''You're looking to add depth for a long season. A lot of things can happen, and the more proven veterans and competitors you can have, I think the better off your team is.''
Wren said the Braves will make a roster move on Friday, when Ayala is expected to join the team for the start of a series in Washington.
Ayala's career ERA is 3.37. He has 19 saves but has spent most of his career in a setup role.
''I think he gives us another proven veteran bullpen piece who has pitched in a variety of roles and had success the last two years with the Yankees and the Orioles,'' Wren said. ''The Orioles were in a bit of a bind roster-wise and made him available. We had been talking with them since the end of spring training to try to acquire him.''
Orioles Rule 5 pick T.J. McFarland, a left-hander, made the team out of spring training. Baltimore was left with a three-man bench after activating right-hander Chris Tillman on Saturday.
Baltimore is expected to purchase the contract of minor league outfielder Chris Dickerson to fill Ayala's roster spot.
''The trade of Ayala allows us the opportunity to keep T.J. McFarland on our major-league staff, someone who we like and would like to continue to develop,'' Orioles executive vice president Dan Duquette said. ''Chris Jones is on track to be a left-handed reliever in the big leagues.''
Jones, 24, was 2-5 with a 3.90 ERA with the Braves' Double-A Mississippi affiliate in 2012. He began this season at Mississippi and gave up two runs in 1 1-3 innings in his only appearance. Jones will be assigned to the Orioles' Double-A Bowie team.
The Braves obtained Jones from the Cleveland Indians in October 2011 in exchange for right-hander Derek Lowe.
AP Sports Writer David Ginsburg in Baltimore contributed to this report.