The IK solver will try to go toward a pre-existing bend: in your rig the upper leg bone is bending on the left (of the mesh) more than on the front, so the IK solver follows that directions (left - left/front).
You can change this behaviour in many ways:
1) the simpler: in edit mode push the head of the leg bone backward and pull the knee joint toward the front; also the foot bone can go backward. In this way the Ik solver will naturally go more toward the front.
2) The classic: create a new bone (I called it Pole Knee L), parent it with the IK foot controller, and in the IK constraint panel, set it as "pole target", fine tuning the "pole angle" parameter for correct behaviour; in this way the knee joint will always point in the direction of this new bone (which can be animated, for complete control).
3) Other ways: constraints that limit rotations, modifying IK bones stiffness, and others that maybe I don't know!
I suggest you also to turn off the "inherit rotation" option of your foot bone, and turn off the "deform" option if IK and pole controllers.