The foxes want sunny weather for their wedding but don't want humans to stumble on their ceremony, so they make it rain on a clear day, is how I've had it explained
How sunshowers became associated with fox weddings is vague. Some say that it has to do with mountains where foxes are mostly found. There are times when mountains are covered in rain, while the town below is clear. People said that the foxes summoned the rain with their magic to hide their wedding ceremony. Others just think that because sunshowers are a mysterious occurrence, going against the natural pattern of clouds and rain, that people assumed a supernatural origin and associated it with foxes.
A very famous painting was done by Katsushika Hokusai which is associated with this legend: