Yes, and even in the group category. More generally, I claim that if $\prod_{i\in I}G_i$ and $\prod_{j\in J}H_j$ are isomorphic groups, for two sets $I,J$ and two families $(G_i)$, $(H_j)$ of groups that are center-free and directly indecomposable, then there is a bijection $f:I\to J$ such that $G_i$ and $H_{f(i)}$ are isomorphic for all $i$.
(Recall that a group is directly indecomposable if it's nontrivial and not direct product of two nontrivial subgroups.)
To show this, it is enough to recognize the subgroups $G_i$ in the product $G=\prod_i G_i$, purely relying on the structure of the group $G$.
Indeed, $G_i$ is directly indecomposable, and $G$ is direct product of $G_i$ and its centralizer (using that $G_i$ has trivial center).
I claim that this characterizes the subgroups $G_i$.
Claim if $H$ is a directly indecomposable subgroup of $G$ such that $G$ is direct product of $H$ and its centralizer, then $H=G_i$ for some unique $i$.
Trivial lemma: Let $H$ be a subgroup of $G=\prod G_i$ ($G_i$ arbitrary groups), and $H_i$ its projection on $G_i$. Let $K_i$ be the centralizer of $H_i$. Then the centralizer of $H$ is $\prod_i K_i$. $\Box$
Now to prove the claim, let $H$ be a subgroup with these properties. Then $H\subset\prod H_i$, which has trivial intersection with the centralizer $K=\prod K_i$ of $H$. Since by assumption $G=H\times K$, we deduce that $H=\prod H_i$. Since $H$ is directly indecomposable, $H_i$ is nontrivial for a single $i$. So $H\subset H_i$, and $G_i=H_i\times K_i$. Since $G_i$ is directly indecomposable, we deduce that $H=H_i=G_i$.