There are three entries to the ISS. The original Soyuz docking ring (which is in use by the Soyuz 'lifeboat'), the added Shuttle ring which used to be the only way to get out and meant that all Spacewalks had to be carried out by exiting to the Shuttle and then leaving via the shuttle payload door. The third entry is the latest - added just last year. The airlock allows direct exiting from the ISS to space and which could be used by the astronauts using a tether to reach the shuttle in near proximity. It's difficult to use but not risky. It's akin to something similar used by Ed White et al in the early 60s. Alternatively an ISS crew member would be able to perform a tetherless flight to the shuttle and carry the astronauts back one by one. This would be riskier, of course, and is untried, but I'm sure someone in NASA has thought about it before. Maybe it'll be added to the flight book for next time. This would mean, of course, that the Shuttle would have to be ditched in space.

A shuttle launch can take several weeks so it wouldn't be possible to sit in the shuttle indefinitely waiting for a rescue mission. Air and food would run out. However, the universal docking ring woudl allow two shuttles to interconnect. Time is the main factor, however, and NASA obviously thought (if there were any problems before re-entry) that an attempt to return to earth was the best option.