Can an Apple Mac computer get a virus? Yes! There is a common misconception that Mac computers can never get viruses, that malware is only a Windows problem. Well that's not true. Probably there are more viruses out there that attack Windows computers, but it doesn't mean it is impossible to get a virus on a Mac. An Operating System, like any complex software, is likely to have many security holes or bugs that could be exploited by a malicious attacker. So yes, it is definitely possible for a Mac computer (or iPad or iPhone or Android or whatever) to get a virus or malware.
As with Windows computers, you have to keep your Mac software up-to-date. Newer versions have built-in anti-virus protection that is kept up-to-date by Apple (as long as you do the updates). Older versions of Mac OS may not be as safe, and you may need to install anti-virus software.
Here is a User Tip from the Apple Support Communities site about protecting your Mac:
Harden your Mac against malware attacks
Here is some free antivirus software available for Mac OS X:
Of course, there are also protection products you can purchase from companies like Symantec/Norton, Sophos, McAfee etc.