From my experience you have to move back in the same direction you entered (As stated by crazy) and if your *Really* stuck, you may want to Quick march back the way you came, though the cool down timer may be a lot if you have a bunch of troops/crates on ya.