Among the curses mentioned in Leviticus is 26:29 (KJV):
And ye shall eat the flesh of your sons, and the flesh of your daughters shall ye eat.
This warning is mentioned again in Deuteronomy 28:53 (KJV):
And thou shalt eat the fruit of thine own body, the flesh of thy sons and of thy daughters, which the LORD thy God hath given thee, in the siege, and in the straitness, wherewith thine enemies shall distress thee
And apparently actually happened, as in Lamentations 4:10 (KJV):
The hands of the pitiful women have sodden their own children: they were their meat in the destruction of the daughter of my people.
and in Jeremiah 19:9 (KJV):
And I will cause them to eat the flesh of their sons and the flesh of their daughters, and they shall eat every one the flesh of his friend in the siege and straitness, wherewith their enemies, and they that seek their lives, shall straiten them.
and in Ezekiel 5:10 (KJV):
Therefore the fathers shall eat the sons in the midst of thee, and the sons shall eat their fathers; and I will execute judgments in thee, and the whole remnant of thee will I scatter into all the winds.
and Zechariah 11:9 (KJV):
Then said I, I will not feed you: that that dieth, let it die; and that that is to be cut off, let it be cut off; and let the rest eat every one the flesh of another.
In fact, there were similar situations as recently as the second world war and in the Gulag of the former Soviet Union, and in the tragic fate of Uruguayan Air Force Flight 571. So the story of the two women in II Kings 6:26-29 is entirely plausible and there is no reason to doubt it.
Apart from the plausibility of the story, the anecdote is required to demonstrate the distress of the king (who is not mentioned by name) who in his role as judge is called on to provide justice to the woman who gave up her son who was eaten. There is in this story an allusion to the judgment of Solomon in 1 Kings 3:16-28, but in this case the king is in an impossibly tragic situation. No decision he makes can possibly be right.