That was one of two references to Macbeth in TLOTR. You see in Macbeth, the witches make two prophecies about Macbeth, that he shall not be defeated until
Great Birnam Wood to high Dunsinane Hill
Shall come against him.
MacDuff later orders his men while marching through Birnam Wood to cut wood from the trees to make torches which they then bear on their night attack on Dunsinane. Burning wood. Shakespeare you card. You hack.
Anyway this is the reason why the Ents exist, so they could literally make a forest march on Saruman's tower.
The second one was the prediction that no man of woman born can slay Macbeth. Turns out that Macduff's mother died in child-birth so he was cut out of her ala the myth about Julius Caesar who gave his name to the Caesarian section. That one really pissed off Tolkien, who realized that if you were going to engage in that kind of word play there were better options like having a nonhuman or a woman kill the target of the prophecy. He went with both, a woman and a nonhuman working together to kill the target.
Here's the thing though, it's not that women or hobbits were the Witch King's kryptonite. It's just that he happened to be predestined to die under that particular circumstance.