The first fish to venture onto land probably possessed a lobed fin, rather like this one. As they crawled onto land these creatures probably used this fin as a lever, giving greater effect to the wave-like motions by which the creatures "swam on land".
At first the limb did not carry much weight, but as tetrapod evolution progressed the limbs became elongated and turned under the body.
To work effectively in this way the limbs became bent down at the elbow and at the knee, and increased leverage was produced by bending outwards of the wrist and ankle.
Digits developed which were useful for keeping a grip on rough surfaces, and the limbs were rotated to the side of the body.