This is more subtle than SLI. The fact in your question is equivalent to the spectral theorem for Hermitian matrices. I will use this formulation of this theorem:
If $X \in \mathbb{C}^{n^2}$ is a Hermitian matrix, then there exists a unitary matrix $Y \in \mathbb{C}^{n^2}$ such that $Y^{-1} X Y$ is a diagonal matrix.
You can see that the theorem can be obtained as a consequence from your statement if you take $A=I$ and $B=X$. It can also be reverted: you can prove your statement using this theorem. Can you see how?
As for the spectral theorem itself, it should be proved in the book you're reading (or the course you're attending, or whatever other resources you're using).
UPDATE: OK, here are a few details on how to derive the statement in the question from the spectral theorem.
First, there exists an invertible matrix $P$ such that $P^*AP=I$. Consider matrix $B'=P^*BP$. Clearly, $B'$ is Hermitian. By the spectral theorem, there is a unitary matrix $Q$ such that $Q^*B'Q=D$ is diagonal. Now we say that matrix $S=PQ$ has the required properties. Indeed: $ S^*AS=Q^*P^*APQ = Q^*Q = I, $ (here we used that $Q$ is unitary), and $ S^*BS=Q^*P^*BPQ = Q^*B'Q = D. $