Sex is known to relieve mental tension and stress from the olden days. Get your girlfriend examined, her headache should not become a worse problem; she might be suffering from tension headache, or some stress or migraine. dont take it as a excuse for enjoying, be a responsible person and take care of her if you really love her.
Yes the headache may be due to some underlying problem. You should act responsibly if you love her. and get proper check and treatment done.