I don't know. If your blood sugar had been very high for a long time before you were put on insulin (I'm presuming you're on insulin.) it's possible
that your headaches are because your body is not used to having lower and more normal blood sugar. If this is the case, it will take a little time for your body to adjust to better blood sugar.
However, it may not be the case so you need to tell your doctor asap. It might be a reaction to the type of medication or the headaches might be from something else, like a sinus infection an it's a coincidence they started when you were put on diabetes medication.
The bottom line: please tell your doctor.