Can staying well hydrated stave off a migraine?

Yes. For some patients this is very important. Irrelevant for others if it works for you than you should do it.
Sometimes. If your migraines are triggered by dehydration, then the most obvious, cheapest and most effective cure is not to get dehydrated. Incidentally, the commonest cause of dehydration (except in a desert) is drinking alcohol. Alcohol, especially tequila and red wine, are very common migraine triggers for many people.