The huorns are one of those examples of an outcome that even the wise do not
foresee, at least Gandalf admits he is taken somewhat by surprise. This
is related to the fate vs. free-will thread with the Witch-king's end in that
the huorns are that unexpected random factor that no one ever accounts for, but
may nonetheless have been part of the larger plan that Eru has devised (or
foresaw, depending on how you want to see his role). In Tolkien's world,
a deus ex machina is to be
expected!
************************
"Elves and dragons! . . . Cabbages and potatoes are better for me and you!"
--The Gaffer