Product of principal ideals: $(a)\cdot (b) = (a b)$
Solution 1:
Take $R:=M_2(\mathbb{R})$.
$$a=b:=\begin{pmatrix}0&1\\0&0\end{pmatrix} $$
Then :
$$(ab)=(0)=\{0\} $$
However :
$$\begin{pmatrix}0&1\\0&0\end{pmatrix} \begin{pmatrix}0&1\\1&1\end{pmatrix}=\begin{pmatrix}1&1\\0&0\end{pmatrix} \in (a),(b) $$
And :
$$\begin{pmatrix}1&1\\0&0\end{pmatrix}\begin{pmatrix}1&1\\0&0\end{pmatrix}=\begin{pmatrix}1&1\\0&0\end{pmatrix}\neq 0$$
So $(a).(b)\neq(ab)$.
Here I used the fact that there are nilpotents of order $2$ in the non-commutative ring. I don't know if you can find an example for a non-commutative-ring with no nilpotent elements (seems harder to me...).
Now for $(a)(b)=(ab)$ in commutative rings.
I claim that this does not hold for commutative ring without unity. First a definition :
In a commutative ring $A$, for $a\in A$, I define $(a)$ to be the set $\{ba|b\in A\}$. It is an ideal of $A$. Note that this definition does not imply that $a\in (a)$ (it does if $A$ has a unity).
Take $A_0:=\mathbb{Z}[X,Y]$ and $A:=(X,Y)$ it is an ideal of $A$ and hence a ring (although it has not a unit, it is an additive group which is closed for the multiplication). From now on any ideal has to be taken as an ideal of the ring $A$ (and not $A_0$).
Then take $a:=X$ and $b:=Y$. I claim that $abX=X^2Y\in (ab)$ but :
$$X^2Y\notin (a)(b) $$
The proof is straightforward because any element of $(a)$ or $(b)$ is either null or has total degree $\geq 2$ hence a non null element of $(a)(b)$ has total degree $\geq 4$ but $X^2Y$ is of total degree $3$.
So I would conclude by saying that both commutativity and unity are essential to this result. However I am still trying to find a non-commutative ring in which $ab=0$ implies $a=0$ or $b=0$ with a unit for which the relation does not hold... Let's see if this works :
$$A:=\mathbb{C}<X,Y> $$
It is the ring of "polynomials" over $\mathbb{C}$ for which $XY\neq YX$ (it exists...). I claim that this is a ring with a unity (it contains $\mathbb{C}$) and furthermore if $ab=0$ then $a=0$ or $b=0$ for this ring. However if :
$$a:=X^2\text{and } b:=Y^2 $$
Then $X^2Y\in (a)$, $XY^2\in (b)$ but :
$$X^2YXY^2\notin (X^2Y^2) $$
So the relation does not hold for "non-commutative domain" even with unity.