Pardon me while I ramble on a bit. This is primarily (or perhaps entirely) for my benefit. Consider it musing or work notes.
Geography dictates the battlespace. As a rule, soldiers aren’t herded together onto a broad, featureless plain, formed up into ranks and columns, and marched headlong at the opposing army doing precisely the same thing. Elevation, terrain flank anchors, concealment, lines of egress — these are considerations. This becomes obvious when one considers major battles, such as Bannockburn, Crecy, etc.
But set battles — planned or simply unavoidable — were the exception. Most armed conflicts on land — from the Classical Era up through the Renaissance — manifested as some sort of siege, a campaign being a series of marches and counter-marches, avoiding battle while taking as many keeps, towns, and, cities as possible while steering clear of the fortifications too tough to crack or too time consuming to starve out.
Now, how would magic effect this truism? I suppose that would depend upon what limitations one imposes on the magic. If it is magic powerful enough to simply vaporise a city, or cause castle walls to disappear then — assuming mages of such potency were common — fortresses would be pointless.
Flight would add a complication. Mass flight especially so: walls aren’t of much use if the enemy can airdrop his entire army inside your defenses. And starving your enemy becomes more problematic when he can resupply by air. But even individual flight would add a wrinkle. Still, countermeasures are conceivable. Netting, for instance. Or fully enclosed structures. Or simply a sufficiency of archers. So, individual flight could be interesting, but not a game changer.
Magic as artillery could be interesting. Taking the place of, or complementing, siege weapons. Or providing counter-battery fire. Incendiary magic, causing combustion within the walls of the besieged town, burning the gates, melting portculli. Excavation magic, performing the job of sappers, undermining foundations or digging tunnels. (Freeing up manpower would, in itself, be of tremendous value. Talk about your force multiplier.)
Illusion would be effective tactic. All war is deception, after all.
Limiting factors would include the assumption that the enemy has similar capability. Your wizard torches the enemy town, his wizard torches your camp. The mage would be priority target, having to be on constant alert for assassins and snipers.
So, in order to retain castles and walled towns as a constant the magic must follow logical, constrained rules. Or the magic must be so rare that mundane threats outweigh the risk of your expensive walls having been a huge waste of resources. There must be limits, defined or inferred (cf. the sieges of Minas Tirith and Helms Deep.)
Things to ponder. At least if you’re a writer gathering plot threads for a fantasy novel.