The king recorded as suffering an illness that caused his bowels to come out was Jehoram of Judah.
The account appears in 2 Chronicles 21. Jehoram, also called Joram, ruled Judah after Jehoshaphat and is portrayed as an idolatrous and oppressive king. He married Athaliah, daughter of Ahab and Jezebel, linking Judah's royal house with the northern kingdom's dynasty. During his reign, Edom rebelled, Libnah revolted, and invading Philistines and Arabians attacked Judah.
According to the biblical narrative, the prophet Elijah warned Jehoram that judgment would follow his actions. The king was then afflicted by a severe intestinal illness. After two years, the disease caused his bowels to come out, and he died in great pain. The text also says that he was not honored with the customary funeral fire given to earlier kings.
Jehoram is easy to confuse with another king named Jehoram, who ruled Israel around the same period. The illness described in this question belongs specifically to Jehoram of Judah in 2 Chronicles 21:18–19. Modern readers sometimes interpret the description medically as rectal prolapse, colorectal disease, or another devastating intestinal condition, but the biblical text does not provide a modern diagnosis.