The marketshare argument has always seemed faulty and weak.
But it's not.
What the other users said is true. Mac OS X and Linux are mostly virus-proof not because they are really more secure than Windows, but because of the Market Share (altough I think Linux patches security holes faster than Apple does with the OS X, when they find one).
Microsoft is reportedly, by far, the company that invests most in security in their OS.
Imagine you're a malware programmer. Why would you, in the past years, target Mac OS X or Linux if they represent barely 5% of all computers worldwide (10% at that time, in USA). You would code something that would only get, at best, in 10% of the PCs in only ONE country? Nope, I guess.
In the last few years, market share has been improving thanks to the iPhone, iPad etc. Now, malware programmers are beginning to target OS X. But not ONLY because of the market share, but because, since Apple never had to worry about this kind of thing, it's easy to spread the virus. Apple always told users Macs don't have viruses, and so users don't worry about malicious web pages and emails. That makes the virus easier to spread, and more effective.
That's so true that when the last couple OS X malwares were found, they had infected a significant amount of Macs and it took a long time to notice the malware infection AND a long time to write a patch that really worked for it.
With Microsoft's 90%+ Market share, almost every malware developer targets Windows. It's not surprising that, even investing heavily in security since Windows XP, Windows still has some exploitable security holes.
Aple is just now understanding how's to be targeted by malware developers and is trying to fix stuff, but new malwares will appear and, you know, things will be more like Windows...
Wanna security? Run OS/2. No viruses, I guarantee. Or BSD, why not?
And the reason there's no virus for iOS and stuff is that iOS is EXTREMELY closed. You can't install anything on it without using the AppStore or jailbreaking it. Android is much more open in this point.
iOS has security flaws, of course, but apparently, none of them are exploitable to make a virus, or Apple is really quick to patch them.
There were a few security holes in the PDF viewing engine last year, if I remember correctly.