I think it refers to the 'stops' on a pipe organ, which govern the various different sounding pipes. These are like round handles that are pulled out of the front above the keys. For the big crescendo sounds the organist needs to pull them all out.
I'd guess it is related to organs, particularly church organs i.e. when playing a piece the organ stops are pulled out during the performance, thus a particularly rousing piece would require one to 'pull out all the stops'.