If your BG's are high then your body will try all sorts of ways to get rid of it. Which means you might wee a lot, or sweat more or create more saliva. All of which is using up water in the body, which can leave you dehydrated. That can cause headaches.
There may be another cause, but it will...