have there been any scientific studies conducted on this subject?
It seems that certain types of headaches can be relieved by certain types of massage
The article Massage Therapy and Frequency of Chronic Tension Headaches says
Objectives. The effect of massage therapy on chronic nonmigraine headache was investigated.
Methods. Chronic tension headache sufferers received structured massage therapy treatment directed toward neck and shoulder muscles. Headache frequency, duration, and intensity were recorded and compared with baseline measures.
Conclusions. The muscle-specific massage therapy technique used in this study has the potential to be a functional, nonpharmacological intervention for reducing the incidence of chronic tension headache.
We can speculate that it may be that relaxing the sufferer plays some part in relieving this type of headache, in which case some individuals who believe that massaging a part of the hand may help will thereby relax and will thereby ameliorate their headache - but I've no evidence to support this.
why shouldn't pregnant women massage the webbing between the thumb and forefingers
No idea, my personal opinion is that this is simply pseudo-science gibberish mimicking the kind of language used in pharmaceutical pamphlets.