You probe it well into the smoke so that the outside temp of the meat has reached a temp that has killed the bacteria so that when you probe it you aren't introducing the outside to the inside.
What Dave said.
I worried about the same thing, when I was just starting out, so I'll give you a couple examples:
If you're doing a Butt, Chuckie, Brisket, or anything like that, which will take 7 to 14 hours or more, you can wait until 3 or 4 hours into the smoke. If your temp is at 225˚ you killed any bacteria on the outside of the meat. Then all you have to do is sterilize your probe, and stick it in. ( I use the alcohol wipes that Drs use before they give you a shot)
As far as the Medium Rare you asked about----I use 230˚ smoker temp for a 5 pound Prime Rib. Most people don't make a Prime Rib smaller than 5 pounds, so this should relieve your worry. If you wait 2 hours, or 2 1/2 hours to sterilize & insert your probe, it won't be too late, because After 2 1/2 hours in 230˚, a 5 pound Prime Rib should be between 100˚ and 110˚ in the center.
Hope this helps,