When is the submodule of a product a product of submodules?
Firstly, I think it is more natural to consider direct sum.
If the ring is assumed to be semi-simple, the answer may be easy, where $M_i$ can be decomposed into irreducible module. I claim that that all submodule of $U\oplus V$ are in form of $S\oplus T$ iff $U$ and $V$ has no common component.
If $U$ shares a common component with $V$, assume that $U=W\oplus U'$, $V=W\oplus V'$, then the diagonal submodule of $W$, $\{(w,w)\in U\oplus V:w\in W\}$ is a submodule not in form of $S\oplus T$.
Conversely, it suffices to show any irreducible submodule $W$ is in $U$ or $V$, consider the projection of $W$ on $U$ and $V$, there must exists one of them are zero, by assumption, otherwise it contradicts to Schur's Lemma, then $W\subseteq V$ or $U$.
Ok so it seems to me there are three different questions here:
(1) When is an ideal of a product of rings a product of ideals ?
(2) What conditions on a ring $R$ can we impose so that submodules of a product (resp. direct sum) of modules are products (resp. direct sums) of submodules ?
(3) Same thing but replacing "are" by "are isomorphic to" ?
(2) and (3) are related but of a different flavour; and they're really far from (1). Nonetheless one may answer them all.
(1) A very interesting sufficient condition is for $I$ to be finite: the idea here being that for $a\in A, b\in B$, $(a,b)(1,0) = (a,0)$.
From that equation (and a tiny bit of work) it follows that the ideals of a finite product of rings are precisely the products of ideals (note: I'm assuming rings are with unit).
However when $I$ is infinite, the product structure nicely interacts with the algebraic structures, and plenty of other ideals come up (except of course if all but finitely many of the rings are trivial rings, but let's assume that all rings here are nontrivial). In fact for an infinite $I$, with the mentioned restriction, there are always ideals that aren't products of ideals.
A good example (which can be very nicely generalized) is the following : $K=\{a\in \displaystyle\prod_{i\in I}R_i \mid $ for all but finitely many $i\in I, a_i= 0\}$. This is clearly an ideal, and is not a product of ideals (you can check that). The relevant generalization of this example uses filters on $I$.
(2) Let's start with the direct product. In this situation, the answer is easy: it never happens. In $R^2$ for instance, there's always $\{(x,x)\in R^2, x\in R\}$ which is a submodule, and unless $R=0$, this isn't a product of submodules (obviously the trivial ring has this property, but I decided not to care about it in this answer). The question with "isomorphic" will be more interesting.
With the direct sum, we have the same issue, in that $R^2 = R\oplus R$ and so we have the same counterexample.
(3) This gets more interesting than (2). Let's start with the product again. Let $m$ be a maximal ideal of $R$ (I'm assuming $R$ is commutative). Consider $\displaystyle\bigoplus_{n\in \mathbb{N}}R/m\leq (R/m)^\mathbb{N}$ as a submodule. Then by hypothesis, $(R/m)^{(\mathbb{N})} := \displaystyle\bigoplus_{n\in \mathbb{N}}R/m$ is isomorphic to $(R/m)^I$ for some $I\subset \mathbb{N}$ (indeed $R/m$ has only two submodules). Hence they are isomorphic as $R/m$-vector spaces. $(R/m)^{(\mathbb{N})}$ has countable dimension as a vector space, so $(R/m)^I$ must as well: in particular $I$ can't be finite, hence it's infinite, and hence $(R/m)^I \simeq (R/m)^\mathbb{N}$. But it's known that $k^\mathbb{N}$ has uncountable dimension for each field $k$ (see e.g. here, it's a diagonalization argument), so that's a contradiction. Hence, there is no such (nontrivial) ring !
For direct sums I don't have a complete answer. In this situation, there's at least one sufficient condition: that $R$ be a field. Indeed, if $R$ is a field then any module is free and the dimension of a submodule is smaller and so the condition is clearly satisfied. But conversely I don't know whether any ring satisfying this needs to be a field.
If $R$ satisfies this condition, then so does $R/I$ for any ideal $I$.