Unlike in CivDOS, Civ3 Walls are cheap as chips, so why not? Of course I'd prefer to fight off invaders outside my cities, but sometimes the AICivs just don't give you that option.
So for a habitual turtle like me, 20 shields for a maintenance-free improvement that strengthens the D-values of all garrisoned units (including the ones you didn't actually intend to use as defenders!) seems like a pretty good deal. If you're willing/ forced to take the punches, the +50% increase in durability (Spear/Sword behind Walls has D=3 even before fortification or terrain bonuses are added) can also end up having roughly the same effect as a Rax -- increasing units' HP -- for half the building-price.
In general, though, I won't build Walls in any freshwater-towns that can grow past Pop6 on their own (because the Pop>7 D-bonus replaces the Walls D-bonus) -- but I will build 'em in potentially exposed dry towns in the early game, especially if it's likely to be a while before I get Construction and/or get round to building a 'Duct there instead. In the mid-game, Walling the border-towns is (much) cheaper/faster than building a Pike/ Mace/ Knight/ Musket there. In the late game (assuming I've made it that far), I might build 'em in exposed towns where I don't ever intend to build a Duct, e.g. Pop1-6 farms on my coasts (Arch and Cont-maps) or borders (for Pan-maps where I'm not going for a military win).
Regarding the GWall (and indeed most of the early Wonders, especially those which go obsolete in the Mid-Age), I don't generally aim to acquire it myself, unless I want/need it to trigger a GA -- but even then I'd prefer to take it from someone else and then (pre)build a Wonder that won't go obsolete.