Lightning is formed by the difference between positive and negative charges. Lightning strikes when the electrical potential becomes greater than the resistance (insulation) of the air, and forces a conductive path to earth (ground or water surface) and will use the best conductor in its proximity.
A boat is a better conductor than air, so if you are close to a storm, lightning will look to you to find an easier path to ground.
What are the chances you will get struck? BoatUS published these statistics below.
Source: Boating News 4