Elephants do not have four knees. No animal does.
The front "knee" of an elephant is actually its wrist. All terrestrial mammals are built upon the same basic body plan. Here
is a reasonably good pic of an elephant's skeleton (with the elephant still around it!).
Note the structure of the forelimb. The big knobby bone halfway down is the elbow, and it bends, not surprisingly, just like ours does. Below is the thick wrist. This is the part that, when bent, may give the impression of being a knee. Which, of course, it isn't.
Note also the hind limb. You can't see the hind foot too well in the image, but you can see the true knee: the joint at the end of the vertical bone (the femur).
Horses, etc., are built similarly, but with different bone length proportions and more "bend" to many of the joints (the elephant is built more pillar-like to better support its weight). Here
is a good pic of a horse skeleton. Again, note the true knees on the hind limb and the knobby elbow of the forelimb (up near the ribcage - the lower joint is its wrist again, and the lowermost joints are "finger" joints). Also note the big ankle bones (or "calcaneus") on the hindlimb (you can move your cursor over the various bones and see what they are).