the body strikes the sand floor with a velocity $v$, then
Potential energy = Kinetic energy
$Mgh=\frac{1}{2}M\upsilon^{2}$
With this velocity $v$, when body passes through the sand floor it comes to rest after travelling a distance $x$. Let $F$ be the resisting force acting on the body. Net force in downward direction
$= Mg - F$
Work done by all the forces is equal to change in KE
$\left(Mg-F\right)x=0-\frac{1}{2}M\upsilon^{2}$
$\left(Mg-F\right)x=-Mgh$
or $Fx=Mgh+Mgx$
or $F=Mg\left(1+\frac{h}{x}\right)$