When the time came for Tamar to give birth, there were twins in her womb.
27. Behold twins were in her womb. Although both Judah obtained pardon for his error, and Tamar for her wicked contrivance; yet the Lord, in order to humble them, caused a prodigy to take place in the birth. Something similar had before happened in the case of Jacob and Esau, but for a different reason: as we know that prodigies sometimes portend good, sometimes evil.
Here is, I. Judah's rigour against Tamar, when he heard she was an adulteress. She was, in the eye of the law, Shelah's wife, and therefore her being with child by another was looked upon as an injury and reproach to Judah's family: Bring her forth therefore, says Judah, the master of the family, and let her be burnt; not burnt to death, but burnt...
Commenting on Genesis 38:24-30
And it came to pass when she travailed,.... Her birth throes came strong and quick upon her: that the one put out his hand; which showed that she was like to have a difficult and dangerous time of it; that the birth was not like to be according to the usual and natural order, which may be considered as a correction for her sin: and...