Literally what Fated Fathom said. It's a 3 in 65355 (about 1 in 21845 chance), which is three times lower than encountering a shiny, so it's pretty rare.
The number is generated after a battle, or when an egg hatches, and the Pokemon that participated in those events (including wild Pokemon that may have been caught in the battle) have the chance of getting it. Traded Pokemon have a higher chance of getting the virus. If the infected Pokemon is in your party, other Pokemon will likely get infected as well.
There's a horribly confusing equation that goes with how to get it, which you can read in the source under 'Technical Information', but for the equation to work in your favour it's a 3 in 65355 chance.
Hope I helped. :)
Source