Amphibians, reptiles, dinosaurs (including their direct descendants, the birds), and mammals are all tetrapods. Even though snakes do not have limbs, they are tetrapods because they evolved from animals with four limbs.
The earliest tetrapods evolved from the Sarcopterygii (lobe-finned fish) into air-breathing amphibians, perhaps in the Upper Devonian period. This means the transition took place in fish, before the land was the main habitat. This is typical of transitional fossils undergoing mosaic evolution.