Originally, Julien was intended to be a minor character with only two lines. However, when Sacha Baron Cohen auditioned for the role, he improvised not only an Indian accent, but eight minutes of dialogue for his recording. The filmmakers found Cohen's performance so funny that they rewrote the script and made Julien a much more prominent character in the story as King of the Lemurs.
Sacha Baron Cohen improvised the line "It's got a gecko on it", and all of the following dialog related to the gecko. The filmmakers found it so funny that they went to the extra work of creating a CG gecko for the shot.
Melman the giraffe wears tissue boxes on his feet. This is a reference to Howard Hughes who was also a hypochondriac and suffered OCD (obsessive compulsive disorder). In his later years, Hughes wore tissue boxes on his feet believing this would keep away germs.
When the camera pans backward from Alex's crate in the ocean, the sea foam around him creates the head of a lion. Foam makes the face, and the absence of foam around that makes the mane. Alex is in the left eye of the face.
When Private is attempting to commandeer the oil tanker, "WHATApiece OFworkIsPenGuin" can been seen on the computer screen behind him. This spoofs the William Shakespeare quote, "What a piece of work is man!" from "Hamlet".
The penguins originated from a film director Eric Darnell was developing, called "Rockumentary", about The Beatles-like rock quartet. When that project was canceled and Darnell was moved to this movie, he incorporated the penguins into the script, changing them from musicians to military commandos.
The scene where Alex dreams about steaks slowly falling down on him spoofs an iconic scene from the Dreamworks movie American Beauty (1999), where Lester Burnham dreams of roses falling down on his daughters friend, Angela. The same song is played in both scenes.
In the original movie trailer Mason the monkey was holding a martini glass while in the movie he was holding a teacup with a plate. The reason was tea and root beer were okay for the monkeys to use instead of drinking beer.
Harry Gregson-Williams was originally attached as the film's composer, but was replaced by Hans Zimmer. A few weeks earlier, the opposite had occurred for another film: Gregson-Williams replaced Zimmer for the scoring duties of Kingdom of Heaven (2005).
In the original script Gloria was going to be pregnant due to being part of the zoo's breeding program and the baby was going to be born on the island and Melman, who is revealed to have a crush on Gloria would help raise the child like it was his own son. The idea was too risky for a family movie so the idea was cut from the final version.
In the director's audio commentary Mort the mouse lemur who is young sweet and cute was originally going to have a joke where he was really 37 years old and the other lemurs called him on that age. But they cut it out for time issues.
When the Penguins unwittingly tunnel into Marty's enclosure, and Skipper says to Marty 'can you keep a secret my monochromatic friend?' He is technically right, even though zebras have two-tone stripes. Monochromatic means one color. Black can always be represented as it is 0% of a color, regardless of which - as technically black is the absence of light/colour. However, to refer to white as monochromatic is somewhat strange as it uses all possible colours.
According to the audio commentary the directors of the film originally didn't want the characters to say Madagascar in the movie but they caved in and decided to let Julien introduce it later in the movie.
The trivia items below may give away important plot points.
At 48 minutes in when Alex's Statue of Liberty burns up and breaks, Alex kneels and starts shouting at the statue. This is a reference to the original Planet of the Apes (1968), though the profane words "damn" and "hell" are replaced with "darn" and "heck" respectively.