Macs and other Apple computer products can get viruses just like Windows products can. However, viruses written for Windows systems generally have no effect on Apple systems, and the majority of viruses are written for Windows.
One difference between Windows and Mac infections is that Windows systems are more susceptible to infections that happen through no fault of the user, whereas Mac infections usually require some action by the user that could have been avoided, like clicking on a bad email link. However, this is not always the case. In 2012, the Fakeflash virus infected half a million OS X systems by exploiting a loophole in Java software running on Macs. It was able to download itself silently without prompting the user.