Let's assume the time to calculate foo(n) is $T(n)$. In the case where $n>0$, we can gather the time taken for an iteration will be:
$$
T(n) = \left( \sum_{i=0}^{n-1} T(i)\right) +n+c
$$
Also, $T(1)=c$
First, a little justification. The summation in the parenthesis is the run time for all the calls to foo in the loop. The n accounts for the looping and the constant c accounts for things such as initialization, comparisons and such.
Now, with that in mid, let's calculate what the next step would be, and see if we can deduce the growth of the run time.
$$
T(n+1) = \left( \sum_{i=0}^{n} T(i)\right) +(n+1)+c
$$
Now, if from the present sum we extract $T(n)$, we get:
$$
T(n+1) = \left( \sum_{i=0}^{n-1} T(i)\right) +T(n)+(n+1)+c
$$
Now, if we rearrange the result in the following way, we have an opportunity for reducing the sum:
$$
T(n+1) =\left[ \left( \sum_{i=0}^{n-1} T(i)\right) + n+c \right]+T(n)+1
$$
You see that in the brackets, that's exactly what we defined as $T(n)$ (1rst equation). In that case, we get that:
$$
T(n+1) =T(n)+T(n)+1 = 2T(n)+1
$$
From this, it also stands that $T(n)=2T(n-1)+1$. What happens if we replace $T(n-1)$ by it's value calculated with this very function? Well, let's iterate:
$$
\begin{array}{r l}
T(n) & = 2T(n-1)+1 \\
& = 2 \left[ 2 T(n-2) +1 \right] +1 \\
& = 2 \left[ 2 \left[ 2 T(n-3) +1 \right] +1 \right] +1 \\
& \vdots \\
& = 2^kT(n-k)+k
\end{array}
$$
Almost there. Finally, let's write it in terms of $T(0)$, our known base case. First, for that we must have $T(n-k) = T(0)$ so it stands that $k=n$. In the end, we get:
$$
T(n) = 2^nT(0)+n=2^nc+n
$$
With this in mind, we can conclude that $T(n) = \theta(2^n)$