The simple answer to your question is that the sun emits photons, a form of electric energy that we see as light. Solar energy utilizes photons to create electricity. Because photons are able to penetrate most substances it wouldn't surprise me that photons interact with our nervous system via the optic nerve or nerves located in the scalp.
I don't know the science or technical jargon behind this, but bright light, such as the sun is impossible for me to deal with, with or without migraines. Then, the heat of summer, just makes migraines trigger repeatedly. All I know is this must be common. I came across a lady this past summer with the same issue during the summer. The migraines are tremendously worse during the hot part of summer.