A few thoughts;
It takes 5-7 years to go through undergraduate medical training, plus the same again postgrad to become a consultant - even though medical school intakes are more feminine these days it will take time to filter through. Consultants getting their jobs at say 40 will generally stay in one job for 25 years, so senior consultants have more probability of being male.
Taking maternity leave as a junior hospital doctor is not easy. Yes it is as legal as anywhere else, but most juniors spend an amount of time on 6 month contracts strung together into a rotation - every trust then tries to wheedle out of paying up! Afterwards, either you have to apply for flexible training (which you may well not be able to have due to cuts in funding) or carry on full time when you get back.
Full time is NOT just 39 hours a week either, most hospital docs in training posts work 48 hours a week plus and it's often a case of staying late at the last minute if eg a list in theatre overruns. My (male) boss was meant to do the nursery run yesterday evening, but had to get his wife to do it when we still had umpteen patients to see in clinic at 4pm. He has 2 DCs, but he wouldn't be able to do it without his DW (who I believe is either SAHM or very PT) There is much more scope to be a PT worker straight after undergraduate training in nursing or midwifery.
Surgical specialties are more prone to these issues than GP or medical ones because of the nature of the work and of the seniors. If your boss never had to take mat leave, or get to school events, nursery pick up etc then how can they understand that you're not being unreliable at work when you have to leave early/bang on time, yet your male colleagues don't? Added to reduced hours (from the 100+ hour weeks of 30 years ago) they get the better training!
Rotating around an area can mean a lot of moving/commuting (I do 2 hours+ daily in the car) If your DP is also a doc he may be commuting the other way! You lose your support network quite quickly moving so often for work.
All this can mean you're spending most of your 30s in the hospital/car as a surgical trainee. Men get away with this as "being the breadwinner" but being a SAHD is rarer than it should ne so women in these jobs do not have the same level of family infrastructure behind them. Doctors already tend to have their families later (I'm 32 and hoping TTc next year once I'm rid of my undergrad loans!)
I can completely see the appeal of being a GP as a trainee, and at the end of that it's more acceptable to be a PT GP than a PT hosital consultant. Even before you consider the OOH commitment (do someone's crash section at 2 am or stay at home in bed ready to get the DCs up for school tomorrow?) These days OOH GPs tend to just do that, not get up and do a clinic the next day. - and they tend to be men.