To become a medical doctor you would need to do a full time medical degree then work as a foundation doctor for 2 years. While I believe you can do the foundation programme less than full time you are still expected to have the same equivalent distribution of working e.g. night shifts etc, across the year. I really doubt you'd be able to work only in term time during that. You'd then need to complete specialty or GP training normally, which again I think you probably wouldn't be able to work only term time. I think it would be mainly after getting your CCT that you might be able to look around and try and negotiate a job plan with that kind of working pattern.
As an alternative after at minimum completing the foundation programme (but probably also e.g. GP training or ACCS) you could look at roles as e.g. a maritime doctor working onboard a ship. Since those are normally annualised contracts where you work X number of months onboard then have X months leave ashore, you might conceivably be able to arrange it with the company to only work onboard during term time. From what people I work with have said most of the doctors have either completed their training as a GP or at least completed core training equivalent in an acute specialty.
For the other roles I think the only way you would be able to arrange that would be working as a locum or bank staff, and just picking and choosing the shifts that work for you. However there would be no guarantee you would have work offered when you want to so that may lead to financial shortfalls. I think technically this is possible with medicine after foundation but I think I read there are far fewer locum medical posts nowadays? Might be regionally variable though.
I think you'd probably find it easier to find term time only roles in an educational (e.g. school or university) setting, as that naturally pairs with the cadence of work in those environments in specific roles (granted most do work full time across the year but there may be more opportunities for contracted jobs with those kind of hours rather than relying on just what are effectively temp/bank roles). Ultimately "term time only" is a very different restriction than part time or less than full time, and I think would be much harder to arrange in most sectors outside of educational ones.