Consider a simpler example: you have a fair coin. You toss the coin over and over and over again. What is the expected number times that you will toss the coin before you get heads? Of course, it is possible that you will toss the coin infinitely many times and never ever get heads. On the other hand, it is also possible that you will get heads on the very first toss. Hopefully, your intuition is that it is extremely unlikely that you will have to toss the coin more than a few times before it comes up heads. We can summarize the whole process with a tree diagram:

The probability at each leaf is the product of all of the probabilities leading up to it (this is a result of independence; note that these kind of diagrams can often be useful for understanding conditioning). On the top row, we just keep tossing tails over and over and over again. The terminal outcomes all end with heads. Then
\begin{align}
\mathbb{E}[\text{number of tosses}]
&= 1\cdot \mathrm{P}(\mathrm{H}) + 2\cdot \mathrm{P}(\mathrm{TH}) + 3\cdot \mathrm{P}(\mathrm{TTH}) + 4\cdot \mathrm{P}(\mathrm{TTTH}) + \dotsb \\
&= \frac{1}{2} + \frac{2}{4} + \frac{3}{8} + \frac{4}{16} + \dotsb \\
&= \sum_{n=1}^{\infty} \frac{n}{2^n} \\
&= 2.
\end{align}
Hence, on average, we can expect to toss the coin twice.
Notice that we can vastly simplify this picture by noting that if we first toss tails, then we go right back to the start. That gives us this picture:

Then
\begin{align}
\mathbb{E}[\text{number of tosses}]
&= 1\cdot \mathrm{P}(\mathrm{H}) + (1+\mathbb{E}[\text{number of tosses}])\cdot \mathrm{P}(\mathrm{T}) \\
&= \frac{1}{2} + \frac{1+\mathbb{E}[\text{number of tosses}]}{2}
\end{align}
The $1+\mathbb{E}[\text{number of tosses}]$ comes from the fact that if we toss tails on the first coin toss, then we have already tossed the coin once, but everything else is as though we just started the process from the beginning. This can be phrased in terms of conditional probability, but I don't think that the extra notation will help much here. In any even, solving for the expected number of tosses, we get
$$ \frac{1}{2} \mathbb{E}[\text{number of tosses}] = 1
\implies \mathbb{E}[\text{number of tosses}] = 2.
$$
So, what does this have to do with the cave problem? To generalize the above argument to the cave problem first imagine that you are in the room described, and have a fair three sided coin (would it be better if I suggested that you had a d3?). Every time you come back to the start, you toss your three sided coin to decide which door to go through. With probability $\frac{1}{3}$ you go through the 3 hour door and come back to the start, with probability $\frac{1}{3}$ you go through the 5 hour door and escape, and with probability $\frac{1}{3}$ you go through the 7 hour door and come back to the start.
So, suppose that you pick the three hour door first. How long do you expect that you will have to walk altogether? You are going to have to walk for 3 hours, but then you are back to the start. The time that you expect to walk from there is the expected time, which is what we are trying to compute. Therefore if you first go through the three hour door, then you are going to walk
$$ 3\text{ hours} + \mathbb{E}[\text{total time}].$$
In other words, using the language of conditional probability (here, it is going to make things a little clearer, I think), we have
$$ \mathbb{E}[\text{total time} \mid \text{chose 3 hour door}]
= 3 + \mathbb{E}[\text{total time}]. $$
By similar reasoning, we have
\begin{align}
\mathbb{E}[\text{total time} \mid \text{chose 5 hour door}]
&= 5 && (\text{we don't go back to the start}) \\
\mathbb{E}[\text{total time} \mid \text{chose 7 hour door}]
&= 7 + \mathbb{E}[\text{total time}]
\end{align}
Since each of these events is equally likely, we sum in order to get
\begin{align}
\mathbb{E}[\text{total time}]
&= \mathrm{P}(\text{3 hour door}) \cdot (3 + \mathbb{E}[\text{total time}]) + \mathrm{P}(\text{5 hour door})\cdot 5 \\
&\qquad\qquad + \mathrm{P}(\text{7 hour door}) \cdot (7 + \mathbb{E}[\text{total time}]) \\\\
&= \frac{3 + \mathbb{E}[\text{total time}]}{3} + \frac{5}{3} + \frac{7 + \mathbb{E}[\text{total time}]}{3}.
\end{align}
It remains only to solve for the expected total walking time. To simplify notation, let $E := \mathbb{E}[\text{total time}]$. The above equation reduces to
\begin{align}
E = \frac{3 + E}{3} + \frac{5}{3} + \frac{7 + E}{3} = \frac{15 + 2E}{3}
&\implies \frac{E}{3} = 5 \\
&\implies E = 15.
\end{align}
In other words, we should expect to travel 15 hours total (which is what the other answers give).
The moral of the story here is that traveling for an infinite amount of time is, in principle, possible. However, it is exceedingly unlikely that you will actually travel forever (in fact, you will travel for an infinite amount of time with probability zero—for all practical purposes, it will never happen).