I'd guess (just a guess) that it is the spiro causing dehydration, which in turn is triggering the migraines.
I've been unfortunate enough to suffer from terrible migraines most of my life, and what I've found is that the number one trigger (at least for me) is stress. Periods of months where I was undergoing more than usual stress lead to like 3-4 migraines a week, and then I could go months without one when I wasn't stressed.
But, as far as the spiro goes, every time I have started it before (like 5 times until I finally got committed to HRT), I'd get migraines for about a week.
But, this is not medical advice, and I am not a doctor - don't take it as such.