Kenneth G. Wilson (1923). The Columbia Guide to Standard American English. 1993.
wall, (up) against the, with ones back to the wall, go to the wall for, off the wall, to drive (someone) up the wall
The first three of these idioms are Standard and are based on the practice of standing prisoners with their backs to a wall so that they may be executed by a firing squad. All three can be used literally, but their figurative applications are much more frequent, describing as they do the extremely bleak prospects of the person at the wall: to be (up) against the wall (or simply up against it) is to be in desperate straits, and if ones back is against [to] the wall, one is similarly about to be executed; to go to the wall for someone is to endure anothers punishment in his or her stead. A person or an action that is off-the-wall is wild, irrational, unexpected, or unpredictable, the figurative sense suggested probably by the unexpected courses of objects ricocheting off a wall. To be driven up the wall means to be maddened, irritated, or thoroughly upset by something. These last two idioms are slang.