Yoan Moncada, Yasmani Grandal, Jose Abreu and Eloy Jimenez connected during a six-run inning, tying the big league record for consecutive homers.
"Clearly, it gets you on your heels,'' Cardinals manager Mike Shildt said. "One of the reasons we liked Roel in spring training ... was the fact that he was not afraid to go after guys. He'd get after it."
Ramirez was optioned off the major club on Monday.
On Sunday, Ramirez took the mound in the fifth with St. Louis leading 1-0. He struck out Luis Robert to start, but things went south quickly. After two singles, a caught stealing and a walk, Moncada smacked a three-run homer to right.
Grandal followed with another drive into the right-field seats, and then Abreu and Jimenez each homered to left.
"It feels good every time that you hit a home run,'' Moncada said through an interpreter. "But it feels better when you're a part of history. ... It's definitely something special for all of us. I am very happy for it.''
Shildt replaced Ramirez with Seth Elledge, and he struck out Edwin Encarnacion on three straight pitches to end the inning.
Ramirez was among the players promoted by the Cardinals following a COVID-19 outbreak that stalled St. Louis' season for 2 weeks. The club returned to action Saturday with a doubleheader sweep over the White Sox.
A 25-year-old right-hander, Ramirez split last season between Double-A and Triple-A.
"He got his first punchout today in the big leagues, which is pretty cool,'' Shildt said. "I have every confidence he's gonna go out and be aggressive when he gets an opportunity again.''
It was the 10th time in major league history a team hit four straight homers. The only other time the White Sox did it was on Aug. 14, 2008, against Kansas City, when Jim Thome, Paul Konerko, Alexei Ramirez and Juan Uribe connected.
The White Sox went on to beat the Cardinals 7-2 on Sunday.
White Sox go back-to-back-to-back-to-back!
The White Sox bust the game open against the Cardinals as Yoan Moncada, Yasmani Grandal, Jose Abreu and Eloy Jimenez all go yard in consecutive at-bats in the fifth inning.