Ross, 31, is 6-9 with a 4.45 ERA in 22 starts for San Diego this season. The right-hander was an All-Star in 2014 and has been the subject of trade rumors for several seasons.
He was the Padres' Opening Day starter in 2016, but that was his only start of the season; he underwent surgery for thoracic outlet syndrome in October of that year.
"It's good to see him have the opportunity to pitch in meaningful August and September baseball games,'' San Diego manager Andy Green said. "I think the world of him.''
The Cardinals have a hole in their rotation after putting Carlos Martinez on the 10-day disabled list July 31 with a shoulder strain. Ross, who has a salary of $1.75 million this season, will be an unrestricted free agent in 2019.
Lyles, 27, is 2-4 with a 4.29 ERA in 24 games, eight of them starts. The right-hander has one year remaining on his contract after this season at $1 million.
"He's always had a really good arm. He's proven he has some versatility being able to throw out of the pen, and he's made some starts this year,'' Brewers general manager David Stearns said. "We think he adds to overall level of depth in our pitching staff right now.''
Milwaukee is extremely thin in its starting rotation with Brent Suter (left elbow) out for the season and Zach Davies (right shoulder) struggling to return from injury. Additionally, right-hander Jimmy Nelson has yet to return from a right shoulder injury that required surgery late last year.
Green said Lyles had been working on changing his approach.
"In Jordan's case, he made some real fundamental changes this year with our pitching coaches and pitched himself in a situation where he's wanted at this time of year,'' Green said.
Stearns confirmed that Milwaukee's scouting department had taken notice of changes that Lyles had made -- especially with the use of his secondary pitches. Milwaukee plans to add Lyles to the 25-man roster later this week.
"We're excited to get him here, and we're excited to get him going,'' Stearns said. "We think he's going to be a valuable member of this team going forward.''
The Padres have the worst record in the National League. The Brewers are one game out of first place in the Central Division, while the Cardinals are in third, 7½ games back.
The Associated Press contributed to this report.