The poet, Shelley, seems to have been the first to use the actual phrase in the early 19th century. A rack was a medi�val torture-instrument on which people's bodies were stretched. In terms of nerves, it means that they are stretched to breaking-point by the situation.