Why divide the t-test p-value by 2 in the SPSS output? In SPSS, the output of a t-test is always  for a 2-sided hypothesis. I know that if we are checking a 1-sided hypothesis, We need to divide the p value in the output by 2. However, it is not clear the theoretical/statistical reason for this. Can someone explain?

I will also focus on the $t$-test as it is in the question, as the answer is not true for every statistical test (like those who are unilateral only).
When you carry your hypothesis, you have to fix your Type I error rate (false positive) and the direction of your effect (bilateral or unilateral). Usually, the first is .05 and the latter is bilateral (as SPSS does). When the test is unilateral (one-sided), you take all the reject area and put it on either side, thus having, let say, $5\%$, on one side. When your hypothesis testing is bilateral (two-sided), you are basically dividing the surface on two sides, thus $.05/2$.
If you look at most statistical tables for critical $t$-values, you will find that you  can swap from unilateral to bilateral or vice versa by dividing or multipliying by $2$ accordingly.

For instance, a $z$-score on a normal distribution (I choose that for ease, but it is true for $t$-values) has $2.5\%$ probability of being in the range $1.96$ to $\infty$ (a one-sided test). It has $5\%$ probabilities to be over $\vert 1.96 \lvert$, that is, including $-\infty$ to $-1.96%$ and $1.96$ to $\infty$ (a bilateral test). Having a unilateral test seems then harder to reject the null hypothesis, halving the type I error rate to $2.5\%$ in the unilateral compared to the bilateral. So, to get the same type I error rate, you can double it. The trade off is that it is on a single side.
The figure below shows that the area in one-sided test is "larger", however the surface are equal, that is, $5\%$. In each panel, their is the exact same probability to reject the null hypothesis (if it is true).

You can more easily swap $p$-value from unilateral to bilateral. You divide the $p$-value by $2$ and you are done. As stated by @clementzach, swapping from bilateral  to unilateral is more tricky as the direction as to be considered (which is why SPSS report the bilateral $p$-values, as it does not care about direction). For instance, a $z = 1.96$ has a $p$-value of $.05$ in bilateral hypothesis, but has a $p$-value of $.025$ for the upper unilateral (from $1.96$ to $\infty$), but a $p$-value of $.975$ if you were looking in the other direction (lower unilateral). So for doubling to be correct, the effect has to be in the correct direction.
