Suppose $T$ is Fredholm. Then there exists a bounded operator $A:Y\rightarrow X$ such that $$AT-I=K_{1T}$$ $$TA-I=K_{2T}$$ where $K_{1T},K_{2T}$ are compact.
Similarly, since $ST$ is also Fredholm, there exists a bounded operator $B:Z \rightarrow X$ such that $$BST-I=K_{1ST}$$ $$STB-I=K_{2ST}$$ where $K_{1ST},K_{2ST}$ are compact.
Consider the operator $D=TB:Z\rightarrow Y$. Then we already know that $SD-I=K_{2ST}$ which is compact. On the other hand, we have
$$DS-I=TBS-I=TBS(TA-K_{2T})-I=TBSTA-TBSK_{2T}-I=$$ $$T(K_{1ST}+I)A-TBSK_{2T}-I=TK_{1ST}A+TA-TBSK_{2T}-I$$ $$=TK_{1ST}A+K_{2T}+I-TBSK_{2T}-I=$$ $$TK_{1ST}A+K_{2T}-TBSK_{2T}$$
Since the compact operators form an ideal in the bounded operators, $TK_{1ST}A+K_{2T}-TBSK_{2T}$ is compact and we are done.
The other direction is proven similarly.