"Carry on, Sergeant" is a normal expression for an Army officer to use; the American equivalent is, "As you were." The title was used to cash in on the popularity of The Ship Was Loaded (1957), which was written by Val Guest. At the time, the success of the film prompted applause and audience laughter in serious settings where the phrase was used, including amongst audiences of the film The Devil's Disciple (1959).
William Hartnell was rather like his character off screen, and could regularly be heard barking at actors who fluffed their lines. Indeed, a visiting brigadier was highly complementary to Hartnell's drilling technique.
The National Service recruits, who should be in their late teens or early 20s, were all played by actors who were over 30 at the time of filming (in fact, Charles Hawtrey was over 40, Kenneth Connor nearly so).
The film had not been conceived as the start of a movie series; only after the film's surprising success did the producer Peter Rogers and the director Gerald Thomas set about planning a further project. After reusing the Carry On prefix and some cast members in their next project Carry on Nurse (1959) and having success with that film, the Carry On series of films evolved.