In this work we study the evolution of the free boundary between two different
fluids in a porous medium where the permeability is a two dimensional step function. The
medium can fill the whole plane $\mathbb{R}^2$ or a bounded strip
$S=\mathbb{R}\times(-\pi/2,\pi/2)$. The system is in the stable regime if the denser fluid
is below the lighter one. First, we show local existence in Sobolev spaces by means of
energy method when the system is in the stable regime. Then we prove the existence of
curves such that they start in the stable regime and in finite time they reach the unstable
one. This change of regime (turning) was first proven in \cite{ccfgl} for the homogeneus
Muskat problem with infinite depth.