For general duty medical officers, it is that they stay within the forces after their initial four-year obligatory service period is up. In most instances that means they stay until the end of their initial engagement, which now, in the new terms of service, is 25 years.
With the specialists it's actually linked more closely to how close they are to the 25-year window once they have finished their obligatory service: if they have less than five or six years, they tend to stick it out; if they don't, then they tend to move on.