The highlighted derivation here is simplifying the originally defined conditional probability via the state-space model (5-1), where we can know $s_1 = f(s_0, a_0, \xi_0)$. Then you need to know the reason why the author here first replace $s_{t+1}$ with $f(s_t, a_t, \xi_t)$ and then revert back at the last step.

Once a specifically structured environment function $f(.)$ is given, the probability of the function value of a any fixed input vector, say $f(s_t, a_t, \xi_t)$, would not depend on any other function value $f(s_0, a_0, \xi_0)$ as long as the three parameters are mutually pairwise independent, which is the case here since as stated in your reference the random noise $\xi_t$ is assumed to be independent of its historical counterparts and initial state $s_0$, and each action $a_t$ is arbitrary and independent of historical states and random noises. This is also why the author needs to weirdly replace $s_2$ as nested $f(f(s_0, a_0, \xi_0), a_1, \xi_1)$ to reduce to the initial state $s_0$ which is a constant and all noises are independent on it as already assumed explicitly above. This process continues until you have the obvious state $s_t$ dependence on itself in the penultimate step.