The notation is somewhat incomplete:
In scattering theory, the in-states $|i\rangle_{in}$ and out-states $|f\rangle_{out}$ live on different Hilbert spaces. So $\langle f | i\rangle$ is really supposed to mean $_{out}\langle f | i \rangle_{in}$, with the meaning that an isomorphism is to be applied that translates $\mathcal H_{in}$ into $\mathcal H_{out}$. That isomorphism is the scattering matrix $S$, i.e. $_{out}\langle f | i \rangle_{in} := \langle f | S | i \rangle$ and on the right hand side $|i\rangle$ and $|f\rangle$ now live on the same Hilbert space.
As indicated by Joao, $S$ is essentially time evolution, i.e. a time evolution operator $U(t_{final}=+\infty ,\ t_{initial}=-\infty)$.
Usually in scattering theory, one considers momentum eigenstates and particular choices of particles. Then the shorthand notation $\langle f| i \rangle$ looks like it could only be non-zero if $|f\rangle = |i\rangle$. Of course, that is not true in scattering, and the illusion only arises because of lazy notation.