A scheme $Z$ is connected if and only if the only idempotent $f\in H^0(Z,\mathcal O_Z)$ are $f=0,1$. Since $H^0(S,\mathcal O_S)=H^0(S\times Y,\mathcal O_{S\times Y})$ for any proper $k$-variety $Y$ such that $k$ is algebraically closed in $H^0(Y,\mathcal O_Y)$, it follows that $S$ is connected if and only if $S\times Y$ is so.