In an emergency, if you must leave the roadway to drive on the shoulder, you should:

If a hazard requires you to drive onto the shoulder of a road, you should try to keep one set of wheels on the pavement to maintain better control of your vehicle. If possible, stay on the shoulder until your vehicle has come to a complete stop, then pull back onto the road when it is safe to do so.
DMV Writen Test Logo