According to Ivan Reitman, Bill Murray insisted that Harold Ramis be cast as his friend for two reasons: 1. They were long-time friends in real life. 2. So Ramis could help Murray re-write his dialogue or help him improvise.
The cast improvised virtually all of the dialogue where they sit around and tell their back stories. This includes Bill Murray's lines about "Lee Harvey" 'making it' with a cow, and calling Sgt. Hulka a "big toe."
According to Ivan Reitman in the DVD commentary, the scene where Bill Murray is loading the rich woman's suitcases into the trunk and he hits himself in the crotch was an accident. Murray really did hit himself in the crotch with the case, thus his very real line "Oh, my balls."
According to Ivan Reitman in the DVD commentary, during the scene where the recruits receive their basic training haircuts he did not tell the actors that real Army barbers would be shaving their heads until the scene was shot. He lined all of the actors up and shot the scene as scripted to get their genuine reactions to their heads being shaved. John Candy became depressed after the scene was shot. This is why you see him picking up his hair and looking sad when he walks out of the barber shop. Since Bill Murray and Harold Ramis were bigger names at that point than the rest of the cast, they were required to cut their hair shorter, but not to shave their entire heads.
The US Army was actually very helpful and cooperative during filming, which surprised Ivan Reitman since the script depicts the military as being made up largely of buffoons.