Robert A. Heinlein’s 1959 novel was a serious work of fiction, written by a man who had himself done military service, having graduated from the U.S. Naval Academy in 1929. It was not a comedy. Hence, the humour in the movie does not derive from the novel.
The novel is an attack on communism, and celebrates the American dream in a manner common in the 1950s. It represents the enemy as an insect race; by implication, this depiction of the 'bugs' as having a hive-mind instead of being individuals is a representation of the communists, as they were usually seen by Americans at that period in time.
The Earth soldiers are fighting for the right to vote. Only soldiers, in the novel, can acquire this right, which has to be earned. The bugs, in contrast, are loaded down by the author with all the worst aspects of communism, being mere slave labour.
The novel seeks to give a realistic picture of life as a boot-camp trainee soldier, and paints quite a grim picture of that. Very little of the novel involves actual combat missions. Despite the notional SF background, the storyline is nevertheless based much more on World War II than on 'The War Of The Worlds'.
Very little of all this makes it into the movie, which is a comedy broadly based on a mix of the Harry Harrison novels Bill the Galactic Hero and The Stainless Steel Rat Saves the Universe, with merely a few character names and placenames borrowed from Heinlein's book.