If you take $R=\begin{pmatrix}k & 0 & 0\\k&k&0\\k&0&k\end{pmatrix}$, where $k$ is a field and the multiplication is given by matrix multiplication, then the direct summand of $R$ given by $\begin{pmatrix}k&0&0\\k&0&0\\k&0&0\end{pmatrix}$ is indecomposable, but has the submodule $\begin{pmatrix}0&0&0\\k&0&0\\k&0&0\end{pmatrix}$ decomposes into two one-dimensional modules.
I did not try for a rigorous proof, but an (at least sufficient) assumption I know in the context of finite dimensional $k$-algebras is that of left (or right, depending if you work with left or right modules) uniseriality as an assumption on $R$, that is the set of submodules of any indecomposable module is totally ordered by inclusion.
For an assumption on $M$ (again working with finite dimensional $k$-algebra) it is necessary and sufficient for $M$ to have simple socle, i.e. there is only one simple submodule of $M$.