I believe it is because doctors would (and perhaps still do) get patients, who are short of breath, to say "ninety nine" whilst placing their hand on their chest as this helps assess the transmission of sound vibration through the chest which presumably helps in diagnosis.
During World War I, even medications - like most things military - were given a number. A Number Nine was, specifically, a laxative pill. The joking idea behind the phrase was that - whatever you had wrong with you - the doctor's first approach was likely to be to give you one of these! Bingo, or housey-housey as it was then generally called, also became popular and so the phrase transferred over to the bingo-caller's number routine.
The government of the Uk once sent out a leaflet giving recommendations for a health lifestyle - one of them, from "Eminent Doctors", said that everyone should go to bed by 9.00pm to get a good night's sleep - therefore "Doctor's orders - 9.00pm"