At first, the team thought Kim could be having an appendix issue, but he was diagnosed with a kidney ailment.
The 32-year-old right-hander is doing better and will be released from the hospital Saturday, Cardinals president John Mozeliak said. He will return to St. Louis for further treatment and recovery.
"Thankfully, it wasn't appendicitis, but there's something going on in his kidney," manager Mike Shildt said. "He was in a fair amount of pain yesterday, but that pain has been able to be managed. He's feeling somewhat back to normal. He's not in as much discomfort as he was."
The Cardinals are hopeful Kim, who has a 0.83 ERA in 21⅔ innings, can pitch again this season.
The ailment comes at an especially bad time for the Cardinals, who have three doubleheaders over the next six days. In all, St. Louis has seven doubleheaders between Saturday and the end of the season.
Kim was next scheduled to pitch against the Cubs on Sunday, and the Cardinals have not yet named a replacement starter. Carlos Martinez, who has been working at the team's alternate site, would not be an option, the team said.