Technically speaking, it is permissible. There are no bars. But the problem is more of a sociological nature, and it is not just Muslim women or their spouses who feel unfcomfortable when consulting a male gyneacologist, I distinctly recall reading a news article long time back mentioning that japanese women resist breast examinations by male doctors, leading to a possibly undiagonized case of breast cancer. Similar feelings are also shared by at least some US women in certain ways. So there is a certain sensitivity here, rooted in the dynamics of men, women and human sexuality. To make matters more complicated, unscruplous male practioners have been convicted of inappropriate behavior with patients. According to canonical Islamic fatawah the order of preference is that a female gynaecologist should examine women and if one is not available then a male doctor can be called upon.
Regarding under what conditions it is disallowed or allowed, well as I said, there should be no conditions whatsoever. It is a veritible field of medical practice and it should not matter if you are a man or woman if you want to specialize in it. Economics and market trends are deciding factors here, not religious edicts. If there is a dearth of gyanaecologists in one geographic area, then of course it seems reasonable that one would specliaze in it to meet the demand, and more importantly, avail a job oppurtunity. That is the supply side of the equation. The demand side is this: given the general preference for female doctors in the Muslim world, their fees tend to be higher (more or less). So what happens to the poor guy who cannot afford a female gyaneacologist for his family member? There has to be mechanism to offset this asymmetry. Here is another point and it is a very important one in my view: you simply cannot have an all female gyaneacologist medical sorrority. In the Muslim world, women are distinctly behind men in professional development--a statement of fact--so who is going to train all these sought after gyaneagologists?