This is the matter of some debate, and there are at least three theories about it that I'm familiar with. I actually found a study online that explains all of them here.
Some relevant sections (copied and pasted since the author explains it better than I would):
The one that is popular in my denomination:
One explanation that is popular among conservative evangelical or
fundamentalist Christians might be termed the Futurist interpretation.
In this interpretation, Jesus is said to have been talking about the
generation alive at the very time of the end, not the generation alive
in the middle of the first century A.D. Thus, the generation that sees
the beginning of the fulfillment of end-time prophecies would live to
see the Second Coming as well.
However, as Gleason Archer has explained,
"This interpretation . . . suffers from the disadvantage of predicting what would normally be expected to happen anyway. Whether
the Tribulation will last for seven years or for a mere three and a
half years, it would not be unusual for most people to survive that
long. Seven years is not a very long time to live through, even in the
face of bloody persecution.''
Another that also has difficulties:
Another explanation is called the Preterist ("past'') interpretation,
which asserts that the Olivet prophecies were all fulfilled in the
first century A.D. This interpretation is more popular among mainline
Protestant scholars, and is also championed by a handful of Catholic
scholars as well.
The explanation that, IMO has the fewest difficulties:
Since there are unsolvable difficulties with both the Futurist and
Preterist approaches to this conundrum, we shall have to seek a
solution in a third approach. What if when Jesus used the word
"generation'' (Greek genea), He didn't mean the same thing that we
mean? What if He wasn't using "generation'' to refer to a group of
people all living at the same period of history?
According to Archer, sometimes genea ("generation'') was used as a
synonym of genos ("race,'' "stock,'' "nation,'' "people''). Archer
Thus, Jesus' words might be rendered, "This people shall not pass away
until all these things are fulfilled.'' In that rendering, He could
have been referring to the Jewish people (which is the most likely
given the context) or to the Church - for both Israel and the Church
are given divine promises that they would remain in existence until
the end of time (Jeremiah 31:35-37; Matthew 16:18).
The last one seems the most likely to me for several reasons:
It's the most simple. It allows the text to be understood without chronological distortions, and it lets the phrase "All these things" really mean "All these things" - all of the end-time events He had been discussing.
It also makes sense because many of the misunderstandings and disagreements in Scripture seem to come from our tendency to use the current English version without understanding the nuances of the original Greek, Hebrew and Aramaic. Quite a few of the Bible "discrepancies" can be cleared up by studying the original language. This appears to me to be one of them.