I, in my arrogance, have always been of the opinion that any new or refurbished semiautomatic pistol should come with three quality magazines. Stay with me on this.
The reason why is that of course you need at least one to make the pistol function. You should of course have a second one because often the easiest way to clear a malfunction is to replace the magazine, and just for the sake of redundancy.
I personally do not carry a third magazine because my pockets/belt are already full of other crap, including my other gun, which I will reach for long before I grab another magazine in all hope. Of course I hope to never require the services of either gun but I'm getting off track here.
But even then I think you should have a third magazine even if all it does is sit in an ammo can just in case something goes wrong with one of the others, you lose one in the field, etc.
I only own two such pistols, but for the XD40 I have 6 factory magazines and for the P89 I have 5 magazines and want to get 1 more. Even for my revolvers I have at least 2 speedloaders or speed strips for each one. With a revolver, two speed loaders is effectively the same thing as having 3 magazines provided you keep your cylinder loaded.
Personally I'm slowly adding to my stock of spare magazines and speedloaders all the time. For me it's not about having some kind of tactical reload option in the middle of a battle in the mall against the enemy ninja clan, it's about redundancy. In the case of many handguns, it simply won't function, or at least not very well, without a magazine. Or something crazy might happen to you, and do you want to sit there with anything less than a fully loaded firearm in its aftermath? I sure don't.
I've personally called the magazine the bane of the self loading pistol and I stand by it. It's an easy to overlook piece of equipment, and even if you are the best gunfighter on this earth and are firing the finest SIG, 1911, or Glock in the world, a minute defect in your magazine can ruin your day. I also feel that in most quality pistols, it's the part most likely to fail on you namely because it's the only part expressly designed to be separated from the rest of the gun with great ease. Not to mention all the headaches a bad magazine can cause. An $1800 pistol with a slightly ill fitting magazine can exhibit all sorts of problems that it shouldn't have.
I will add one more consideration to this as well: Use good quality magazines that make the most of your firearm. Sometimes you may be compelled to use aftermarket magazines for various reasons. Do your homework and make sure to test all magazines for function.
Speedloaders and speed strips are a little safer bet. There's not a whole lot of people making them compared to how many people might make magazines for your gun. I have never personally encountered such a product that was somehow defective or flawed.
So how many magazines/speedloaders are probably enough? As always it depends on you. For me personally it's six because most trainers require you to come to class with 6 magazines or speedloaders for your gun, but I feel I could get by on 3 magazines for a semiautomatic or 2 speedloaders/speedstrips for a revolver otherwise.