Creating a magic system is about organization; without it, we don’t have a “system.” The problems with an on-the-fly approach are numerous, one of the biggest being inconsistency. Readers are astute. If rules prohibit a character from doing something at one point, and we have them do it (or something similar) later, in defiance of that rule, readers will notice. This can happen due to forgetfulness and not writing down any spontaneously invented rules. We also sometimes imply a rule without realizing we’ve done so, only to break it later. And breaking our own rules makes it apparent we don’t know what we’re doing.
Another problem is giving people the ability to solve something with magic right when they need it. Deus ex machina is considered poor storytelling. If we want to do this, we shouldn’t make the magical solution perfect. If they need to go fifty miles, make the spell only transport them forty miles, depositing them somewhere that presents new issues. Perfect solutions eliminate conflict, which is the heart of any story. Having a system helps us create limits. Without a system, it’s harder to contrast multiple styles or types of magic. Each should have its rules, limits, benefits, and problems. The point of a system is to decide who can do what and under which circumstances, bringing order to the potential chaos of magic being everywhere and there being no limits.
But we don’t always need a system. If we’re writing a short story, we’re less likely to break rules, for example, because our tale will end before we can. The longer a work is, or the more times we’ll use the setting, the more we need a system. And if magic is very prevalent, we’ll need a system to impose limits and be realistic; without one, we’re at greater risk of inconsistency and mistakes. But if magic is rare or a minor part of a story, we may do well enough without one.