According to the context of the speech, Kennedy meant that he stood together with West Berliners in their struggle to maintain their freedom against communist aggression.
The phrase also enjoys an amusing ambiguity because it can be interpreted in two ways:
The common everyday expression for saying that you are from Berlin (i.e. you were born there) is "Ich bin Berliner". The idiomatic usage of "ein Berliner" refers to the doughnut.
The best parallel in English would be "I am a Frankfurter" which of course also means "I am a sausage". Although the sentence is grammatically correct you would normally disambiguate by saying "I am from Frankfurt". Several other German and Austrian cities follow this example; Hamburg - hamburger, Vienna (Wien in German) - wiener, etc. The extra "-er" at the end simply specifies "of ...", not whether it is a citizen or a meat product.
Some contend that this ambiguity fed an urban legend that arose in Florida in the 1980s and culminated in a NY Times article in 1987 - that the error was embarrassing and resulted in laughter. The context made the meaning very clear, though, so nobody misunderstood JFK when he delivered his speech. He did however pronounce the sentence with a very strong American accent, reading from his note "ish bin ine bear-LEAN-ar". Contrary to the urban legend, it was not followed by a roar of laughter. Audio and film recordings show the remark was followed by applause and cheers, as was witnessed by television audiences in Europe and the United States at the time.
Interestingly, Kennedy did get a laugh a moment after he first used the phrase, but deliberately. His speech was being translated into German for the crowd phrase-by-phrase. "Ich bin ein Berliner" was "translated" to itself, resulting in the interpreter parroting what Kennedy had just said a moment before. As the applause died down, Kennedy paused for a moment, then said: "I appreciate my interpreter translating my German", a quip which did receive a solid laugh from the crowd.