If $xy$ is a unit, are $x$ and $y$ units?
There is no doubt if a and b are units then ab is a unit. How about the converse? Still holds?
This is untrue in general, but $a$ and $b$ do have one-sided inverses.
Proof: If for $a,b \in M$, $ab$ is a unit, then $\exists k \in M$ such that $(ab)k=k(ab)=1$.Since multiplication in a momoid is associative, we have that $a(bk)=1$ and $(ka)b=1$, demonstrating explicitly a right inverse for $a$ and a left inverse for $b$. But as Arturo Magidin's example-which he has linked to-demonstrates, this may be the best we can obtain.
What do you mean by "unit"? Usually it means the identity element, but there can only be one of those in a monoid, so I'll assume you mean an invertible element.
If the monoid is commutative, then $ab$ invertible easily implies $a$ invertible and $b$ invertible.
In a non-commutative monoid: if $ab$ is right invertible, then $a$ is also right invertible, but we cannot say anything about $b$ in particular. (For example, in the monoid generated by $a$, $b$ and $c$ with the single relation $abc=1$, $ab$ is right invertible, but $b$ is neither left nor right invertible).