Then why can we say that:
Because, each $S_i$ can only take on two values: +1 or -1
For example, if $S_1 = +1$ and $S_2 = +1$ then the $e^{\beta J S1S2}$ is ${e^{\beta J}}$, which is exactly what the ++ matrix element of $T$ says.
As another example, If $S_1 = +1$ and $S_2 = -1$ then the $e^{\beta J S1S2}$ is ${e^{-\beta J}}$, which is exactly what the +- matrix element of $T$ says.
And so on.
Update:
In the Dirac bra/ket notation, $\left < S | T | S' \right >$ is a number that depends on S and S'. (Note: We could use a different symbol to denote $T$ as a stand-alone matrix vs $T$ when it is in the Dirac bra/key notation, but in this case we dont.)
For example, when S=+ and S'=+:
$$
\left < + | T | + \right > = e^{\beta J}
$$
For example, when S=+ and S'=-:
$$
\left < + | T | - \right > = e^{-\beta J}
$$
For example, when S=- and S'=+:
$$
\left < - | T | + \right > = e^{-\beta J}
$$
For example, when S=- and S'=-:
$$
\left < - | T | - \right > = e^{-\beta J}
$$
And we write these four possible values together in a matrix, whose indices span + and - in both directions.