In my opinion, Euler just considered the logarithmic derivative ($\frac{d}{dz}\log(\cdot)$) of both sides of
$$ \frac{\sin(\pi z)}{\pi z}=\prod_{n\geq 1}\left(1-\frac{z^2}{n^2}\right) \tag{1}$$
to derive the above identity, disregarding possible convergence issues. $(1)$ was well-known to him, and the key for his solution of the Basel problem. The possibility to apply the logarithmic derivative to both sides of $(1)$ follows from the whole Mittag-Leffler/Weierstrass products machinery.
It is possible to prove $(1)$ for $z\in\mathbb{R}$ (together with its uniform convergence over any compact subset of $\mathbb{R}$) by avoiding complex analysis, just exploiting the properties of Chebyshev polynomials of the second kind, but I am not so sure that Euler was aware of that (also because Chebyshev came about 100 years later than Euler).