After medical school, doctors still aren't qualified or licensed to practice - they need to go through residency first, which pays really poorly (in some cases, less than the equivalent of minimum wage). During that time, doctors aren't going to be paying down their loans, because they're just making enough to get by. (Some doctors even end up having to take on additional debt just to get through residency. That debt comes from the private market and has a higher interest rate than the unsubsidized Stafford loans).
This period lasts anywhere from 4-10 years, depending on your specialty. In the end, it's not unusual for a doctor who enters medical school in their mid-20s[0] and is not independently wealthy to expect to turn 40 before paying off their final medical school loan.
Medicine isn't the unbelievably, guaranteed lucrative field people think it is. It may have been in the past, but those days are long gone, and the expected lifetime earnings for physicians continues to drop each year, which means it takes even longer to pay off your debt.
[0] This is actually typical; most physicians, especially at top schools, don't enter medical school straight out of their undergraduate program