Let $R$ be a ring and $I,J$ two ideals. If $I \cap J=0$ then $ij=0$ for every $i \in I$ and $j \in J$. This happens when $R=A \times B$ and $I=I’ \times \{0\}$ and $J=\{0\} \times J’$ with $I’$ ideal of $A$ and $J’$ ideal of B.
Is this the only case when this happens?
No, the ring need not be decomposable into two pieces.
For example, take $F[x,y]$ and localize at the maximal ideal $(x,y)$, then take the quotient by the ideal $(x)\cap (y)$ in the localization.
In the resulting ring $R$, the ideal generated by $x$ and the ideal generated by $y$ are distinct from each other and from $(x,y)$, and they have a trivial intersection because we took the quotient by their intersection.
The ring can't be decomposed into two pieces, though, because it is a local ring with unique maximal ideal generated by $x$ and $y$.