N. K. Jemisin argues, in "But, but, but — WHY does magic have to make sense?"
that magic in a story shouldn't have to make sense, because
This is magic we’re talking about here, right? Force of nature, kinda woo-woo and froo-froo, things beyond our ken, and all that? And most of all, not science? Because sometimes I wonder. Sometimes, whenever I see fantasy readers laud a work for the rigor of its magic system — we’ll come back to this word “system” later — I wonder: why are these people reading fantasy? I mean, if they’re going to judge magic by its similarity to science, why not just go ahead and read science fiction? Science fiction has plenty of its own magicky stuff to enjoy (e.g., FTL, “psi” powers). Shouldn’t fantasy do something different, not just in its surface trappings but in its fundamental assumptions?
The main reason why is that, in the story universe, magic is being presented as real and able to affect other real things which are presumably internally consistent. If the magic is not internally-consistent, then the magic is not going to be perceived by the readersas "real," and hence neither will the other aspects of the storyverse which the magic affects.
If the magic in one's story does not "make sense" at least in terms of internal consistency then one is undercutting one's own verisimilitude. This is particularly-bad if there is something obvious that the characters could do given the displayed capabilities of the magic in one's world, which nobody is doing, and which no in-universe reason exists not to do.
One classic example of this would be a world in which, say, every lord has a court wizard who can fly over or push down walls, and yet every lord lives in an expensively-built medieval castle complete with high vertical walls. Bonus verisimilitude destruction points if this becomes a major plot point, in that the brilliant protagonist defeats the foe by realizing that he could use magic to defeat the enemy's walls.
This begs the question, to the alert reader, of just why no one has thought of doing this before, unless there is a specific reason given or at least implied for why this wouldn't work (for instance, if magic opposes the wills of even non-mages near the objects one is trying to affect, in which case the earnest desire of the defenders to not have their walls fall down might prevent combat siege magic). And, if the protagonist alone thinks of using magic to topple walls after the techniques have existed for centuries or millennia alongside vertical fortifications, then the effect becomes not so much "Oh, how cunning is our hero!" but rather "Oh, how stupid is everyone else in the storyverse!", which is not a good effect if one is trying for serious drama.
One can, of course, imagine low-order reality "dream worlds" in which "wishing will make it so," and this can work too (as in Lovecraft's Dreamlands), provided that the writer has a good idea of the methods and limits of such "wishing." The Dream-quest of Unknown Kadath would not have worked as a story if Randolph Carter could have simply wished for anything, anytime he wanted: he just would have wished himself into his dream-city on the first page, end of story (and if he didn't, then the reader would be wondering "why?"
Instead, notice what Lovecraft did. He established that ony an "experienced" dreamer could consciously get what he wanted, and that these were mostly rather mundane things from the POV of the Dreamlands: it was an exceptional and unique thing that Carter had managed to find a whole city (only King Kuranes in-story had accomplished an even remotely similar feat, and his city didn't tempt the very Gods) and that, in fact drove the whole plot because it was seducing the Gods of Earth away from the rest of the Dreamlands. Because Carter could mostly only dream the convenient appearance of things like riding-beasts and clothing and stuff like that, he had to embark on a quest to find his city.
All stories with magic will have an implicit magic system, even if the rules are never spelled out. To take classic European fairy tales, the usual reason why "wicked witches" are able to do magic is implicitly because they have sold their souls to the Devil. (Disney, of all sources, sometimes alludes to this). We often miss this because we do not share the world-view in which those stories were first created, told or even written down (the Brothers Grimm may not have believed in effective diabolism; but their peasant informants probably did).
If one violates the implict magic system one has established, the readers will notice this. Humans are good at pattern-sensing (it may lie at the root of "intelligence" in general) and we tend to notice when a pattern is broken. We feel a sense of "wrongness" when a pattern is broken, and this sense of wrongness will destroy the story.
This is why magic in fantasy has tended to evolve toward a more logical presentation. This is true even if (especially if) the system of magic doesn't correspond all that well with real physical laws. For instance, in Tolkien's Middle-earth reality responds to chanting and singing because it was sung into being at the Creation. Our world wasn't, but his was, and thus it makes perfect sense that more singing can change it.
There are of course subtle logical inconsistencies here, but verisimilitude can survive subtle illogics. It can't survive a complete lack of concern for internal consistency. And neither can the stories which stand upon it.
For the deepest reason why the magic in a storyverse has to make sense is contained in Jemisen's own line
Force of nature, kinda woo-woo and froo-froo, things beyond our ken, and all that? And most of all, not science?
Ah, but in our Universe the "forces of nature" are not based in magic, but in science. And any magicks which do exists must be either very weak or very subtle, because if they were powerful and obvious, we would have noticed them.
Come to think of it, we did. Both chemistry and electromagnetics had their origins in "magical" practices, which we eventually systematized and understood.
But if it was possible to, say, reliably strike people dead with lightning bolts powered by the force of one's will, or turn people into frogs, then people would be DOING this, and we would not see it as "magic." We would instead be highly motivated to understand the powers, their summonings and their limitations: in short, we would chart the Laws of Nature that governed them, just as in ouruniverse we chart the Laws of Nature which govern chemistry and electromagnetism.
The reason why we perceive magic, in our Universe, as "kinda woo-woo and froo-froo, things beyond our ken" is because magic, in our Universe, is either nonexistent or very weak or very subtle. But if, in the story Universe, magic is capable of being strong and direct, then it will not be perceived as "woo-woo and froo-froo" by the denizens of that Universe.
If the writer shows that she -- and the people in her Universe -- perceive magic as "woo-woo and froo-froo," then what she is communicating is that neither she nor they are taking it at all seriously. And if the writer isn't taking it seriously, then how can anyone else?