A bit too long for a comment:
If we consider a short "arc" of the rainbow, all the light contributing to the rainbow (as opposed to background light) would probably tend to be polarized in the same direction.
This is because the "rainbow light" was first refracted when it entered a water droplet through the "front" hemisphere of the droplet surface, then reflected on the "back" of the droplet surface, and finally refracted again when leaving the droplet again through the "front" surface. The geometry will be nearly the same for all the droplets within this short arc of the rainbow.
This refraction-reflection-refraction sequence will favor some polarization directions, as I said.
I suspect this is why, when you turn your sunglasses correctly so they match this polarization direction, the rainbow will be sharper: The background light from the daylight sky (which tends to outshine the rainbow) will be dimmed much more than the rainbow itself.
Maybe the daylight from the sky almost opposite the sun is polarized as well (whether or not there is any rainbow). Did you see this effect near the "top point" of the rainbow where the rainbow arc is close to "horizontal", or closer to one or both "legs" of the rainbow where the arc is more "vertical"?
After googling, I found a YouTube video showing how great this effect is.