It does indeed sound like your daughter is having an ophthalmic migraine.
Migraine headaches are basically vascular spasms that produce pain and visual symptoms.
I doubt if the reafractive error has anything to do with it. Migaines often run in families. Individuals who start with migraines often start around the onset of puberty, so, age 10-11 or so years of age. Similarly, kids that need glasses often start around 10-12 years of age. So, I suspect that the two issues are unrelated.