When you have a headache it's usually safe to drive.
That is unless the headache you have is really severe.
As long as the headache you have is not too severe then driving with a headache is usually safe.
But if the headache is causing you to lose concentration then do not drive until the headache goes away.
Driving requires your full concentration and having a severe headache can cause you to lose concentration on the road and your driving.
When that happens then you could lose control of your vehicle or wreck into another vehicle and cause a serious car wreck.
So if you do have a headache take some aspirin and if the headache is too severe avoid driving until the headache goes away.
But if you just have a slight headache then you can drive.