I'm not saying this situation doesn't arise, and I'm not denying that being on your toes and doing some general preparatory practice work is good advice.
I'm just saying, it's not the ideal, it shouldn't be a substitute, and if you can rehearse, by all means, please take advantage of the opportunity.
Knowledge of theory, scales, and even the song itself does not prevent train wrecks when you get a bunch of musicians on a stage who each has their own idea about structure, tuning, key, modulations, etc.
EDIT: It is probably good to distinguish between different players and situations. One, like nic_salsus, either knows the music or the other musicians well, and has a lot of experience in these situations. He gets the call and has to come through at the drop of a hat. Clams, imperfections, etc., are quickly recovered upon and hidden from the ears of all but the most discriminating listeners. The other situation is people who are not "fill-ins" necessarily, but a more cohesive band. Maybe they lack the experience to play songs well on the fly, maybe the material is too complex or arrangements too detailed. Bands should rehearse if possible.
Blues and jazz guys, you should know what's up and be able to play on the fly if needed.
Cover bands doing "Carry On Wayward Son" or "Radar Love," I wouldn't try those without at least one rehearsal. I would bet my bass collection there is at least one person in the band who hears it different from you, and that needs to be worked out before you get up in front of a room full of people and put your reputation on the line.