Let $\lambda(t)$ be the intensity function and $\Lambda(t) = \int_0^t \lambda(s)\ \mathsf ds$. For any $t>0$ we have $\{T_1>t\}=\{N(t)=0\}$ and hence
$$
\mathbb P(T_1>t) = \mathbb P(N(t)=0) = e^{-\Lambda(t)}.
$$
Differentiating the above, we find the density of $T_1$:
$$
f_{T_1}(t) = -\frac{\mathsf d}{\mathsf dt}\mathbb P(T_1>t) = \lambda(t)e^{-\Lambda(t)},\ t>0.
$$
Similarly, the probability of $\{T_2-T_1\geqslant t\}$ conditioned on $\{T_1=s\}$, is $e^{\Lambda(s)-\Lambda(s+t)}$, and differentiating yields the conditional density:
$$
f_{T_2\mid T_1=s}(t\mid s) = \lambda(s+t)e^{\Lambda(s)-\Lambda(s+t)},\ t>0.
$$
The joint density of $(T_1,T_2)$ is then given by the product:
$$
f_{T_1,T_2}(s,t) = f_{T_1}(s)f_{T_2\mid T_1=s}(t\mid s) = \lambda(s)\lambda(s+t)e^{-\Lambda(s+t)},\ s,t>0.
$$
The marginal density of $T_2$ is obtained by integrating the joint density with respect to $T_1$:
$$
f_{T_2}(t) = \int_{\mathbb R} f_{T_1,T_2}(s,t)\ \mathsf ds.
$$