With St. Louis holding a 5-1 lead and with one out and a 2-1 count on White Sox hitter Elvis Andrus, Montgomery tapped the back of his right leg with his glove.
Cardinals manager Oliver Marmol and athletic trainers went to the mound, and Montgomery left the game, walking slowly to the dugout.
"Hamstring grabbed at him," Marmol said. "Kind of his foot slipped as he was coming down the mound. We didn't want him to pitch through it."
Montgomery said his leg would be imaged on Saturday.
"I just kind of slipped on the mound and I guess my body just tried to catch myself," the 6-foot-6 lefty said. "It's just kind of a freak thing."
JoJo Romero replaced Montgomery and got the final two outs of the inning. Then Chicago went on to rally against Romero and three other Cardinals reliever.
Montgomery (6-7) was looking for his fifth straight win after seven consecutive losses. The 30-year-old allowed one run on three hits in 4 1/3 innings. He had allowed just a single and a walk though the first four innings.