Cancer is typically caused by improper DNA repair (you can read all about it: https://en.wikipedia.org/wiki/DNA_repair).  The gist of it is that cellular DNA becomes damaged in such a way that a repair to the DNA of the cell fails to restore the original DNA, and also corrupts it in such a way that other cellular mechanics to encourage programmed cell death under these circumstances do not trigger.

Now, the human body repairs a *lot* of damage to cellular DNA every day, and the odds of this kind of improper DNA repair happening, and it having the necessary changes in DNA to become cancerous, is fairly rare (otherwise everyone would have cancer from the day they were born).  It is a statistics game, however, and unless something else kills us beforehand, statistically speaking, everyone will get cancer.

Cancer spreads rapidly by several mechanisms, but one of the key ones is the activation of Telomerase, a Ribonucleic Protein that add a telomere repeating pattern to the end of a DNA chain (typically these patterns naturally limit the number of times a cell can divide, the Telomerase removes this limit).  Without a mechanism to limit the number of times a cell can divide, they divide indiscriminately and constantly.  

Cancer tends to bypass the immune system because it is composed of cells from the same host, and is often recognized as part of the healthy body (one of the research pathways to cancer fighting drugs is aimed at flagging cancer as a foreign body).  

In theory, a virus or other method could be devised to inflict a cancer-like disease on an alien race.  However, depending on how their biology works, it may or may not have the same effect.  They could be different enough on a biological level that they would be immune to cancers, and the condition would never occur.