Let me work over $\operatorname{Spec}(k)$ just to show that even that case is hard. There is a map $\operatorname{Aut}(A) \times \operatorname{Aut}(B) \to \operatorname{Aut}(A \times B)$. I doubt one can say much more than this without knowing something about the specific geometry of $A$ and $B$. For example, if $A = B = E$ is an elliptic curve, then $\operatorname{Aut}(A \times B)$ is much larger than either $\operatorname{Aut}(A)$ or $\operatorname{Aut}(B)$, since there's an action of $\operatorname{GL}_2(\mathbb Z)$.

I'd expect that something similar can happen with other $S$, for example, if you have two surfaces elliptically fibered over $\mathbb P^1$, and take the fiber product, in general $\operatorname{Aut}(A \times_S B)$ (either over $S$ or just over $k$) can probably increase in size, but saying exactly what it is probably pretty delicate in general.

Things are better if you know something about the geometry. For example, if there is no nonconstant map $A \to B$, then any automorphism of $A \times B$ has to permute the fibers of $A \times B \to B$. If $\operatorname{Aut}(A)$ is a discrete group, this means that the map from the first paragraph should be an isomorphism.