Instead of spending days or even weeks on an individual track, as they had done on most of the tracks for Sgt. Pepper, they quickly dashed off a couple numbers to satisfy the film's producers. On May 11th, 1967, they started, completed and mixed for mono the Lennon-McCartney collaboration Baby You're a Rich Man in six hours at Olympic Sound Studios (though intended for the film, and briefly used in it, this song soon became the B-side of a single and never made it onto the original soundtrack album). The next day, May 12th, they reconvened at Abbey Road Studios to record a new McCartney offering.
All Together Now sounds deceptively simple, especially given its lyrics, but the gradual acceleration of the song had the potential to be quite tricky. Yet the Beatles and their studio guests who joined in the singalong pulled it off in only nine takes, plus overdubs. The recording was completed and mixed for mono within a mere five and a half hours. This is all the more remarkable considering that producer George Martin was not even present to oversee the proceedings - engineers Geoff Emerick and Richard Lush manned the control room alone that night.
The song is used early in the film soon after the submarine voyage commences. As brief as the song is, an even shorter version of it is used at the end of the movie. Though they do not actually sing it or even mime to it, the Beatles met at Twickenham Film Studios on January 25th, 1968 to film a short live action sequence to set up the reprise of the song.