In talking to a few SF docs, SF medical service corps personel, and other students interested in this, I'll try to give my take on this.
In order to be an SF doc, you do not have to go through Q school and all that jazz. In fact, most of the battallion docs are not Q school qualified, and you do not have to be ER. They do generally have airborne and maybe air assault which are much shorter and much easier courses. The majority of the slots are "flight surgeon" slots. SOC did this specifically so the doctor's spots are not limited to a specific specialty. Instead, any doc in any specialty can go through the 6 week flight surgeon course and be eligible for a SOF position. Now, these docs do not get too involved in all of the "cool" training and missions. They are support and generally stay at the base of operations and the 18D (medic) will stabilize any casualties and bring them back to the doc for further work and evac. If a doc is highly motivated, he can do some of the SOF training with the unit, but only what he can handle easily.
There is a second type of SF doc who is a little bit crazy and goes through the entire Q school and such. After the first two phases of Q school, the applicants break up into their specialty (weapons, demo, medic). The medic section is 6-9 months long, but docs get a shortened, modified course for this. Then they return for the final phase of Q school. If you finish this school, then you are a green beret doc and not just a doc working with the green berets. In any case, your role is still going to be very similar to the doc above, but you would probably go on more direct missions rather than being at the base camp.
There are very few docs who attempt Q school and only a handful actually make it. Most docs instead chose to work with SF teams and call that good enough. This is usually done right after residency training, but could theoretically be done as a GMO. However, when selecting the docs, residency trained docs are given higher consideration because they can do more for the team, especially if the team were trying to treat the local populace to build a relationship.
A quick note on the difference between SF and Rangers. Rangers are more of a kick the door down fighting force with specialized training. The SF guys' main job is unusual operations such as working with a local community, training foreign soldiers, and more delicate things like that with the ability to fight their way out of messes should things go bad.