Formally, I see it as emerging from the trace necessary to compute observables in quantum mechanics,

$$ \langle O(t) \rangle = \text{Tr}\left[\rho O(t) \right] \, .$$

I use Heisenberg's picture, $O(t) = \text{e}^{\text{i} t H} O \, \text{e}^{-\text{i} t H}$ and $\hbar = 1$. The path integral representation of the time evolution operator gives

$$\left. \langle x \right| \text{e}^{\text{i} t H} \left| x \right. \rangle = \int \text{D}x \, \text{e}^{i S} \, ,$$

with $S = \int_0^t \text{d}t [...]$ an action that contains a simple time integral from $t=0$ to $t=t$. In thermal equilibrium, you can set $\text{i}t = -\beta$ and compute observables from

$$ \langle O \rangle = \text{Tr}\left[\text{e}^{-\beta H} O \right] \, .$$

There is only one time path. Out-of-equilibrium however the **two **terms $ \text{e}^{\pm \text{i} t H}$ must be taken into account. Each leads to the same action. Only the direction of time changes. The full expression for the time dependent observable is

\begin{align*} \langle O(t) \rangle & = \int \text{d}x \, \text{d}x'\, \text{d}x'' \, \text{d}x''' \, \\ & \qquad \times \left. < x \right| \rho \left| x' > \right. \left. < x' \right| \text{e}^{\text{i} t H} \left| x'' > \right. \left. < x'' \right| O \left| x''' > \right. \, \left. < x''' \right| \text{e}^{-\text{i} t H} \left| x > \right. \, ,\\ & = \int Dx \, \text{e}^{\text{i} \left[ S_{+} + S_{-}\right]} \, \left. \, \left. < x_-(0) \right| \rho \left| x_+(0) > \right. \, < x_+(t) \right| O \left| x_-(t) \right. > \, ,\end{align*}

where $S_+ = \int_0^t \text{d}t[...]$, $S_- = \int_t^0 \text{d}t[...]$ and $x_{\pm}(t)$ are the paths on the forward and backwards paths respectively. The integrals over the boundaries, $x=x(0)$, $x'=x(0)$ $x''=x(t)$ and $x'''=x(t)$ have been absorbed into the functional integral, $\int Dx$.

This is a very quick answer. Tell me if you have trouble filling in the gaps. The generalisation from quantum mechanics to quantum field theory is straightforward.