I believe there was an Air Marshall Stack, who, in his lower command years would cut no nonsense about guys having to wait around the crewroom for 5 o'clock before going home, as many of the COs insisted.
He frequently told guys that if they had finished their work they should bu**er off home to the missus.
The term 'stack' became the word to describe this process.
Or so I believe...