Consider the Gorrila, the Chimpanzee and the Gibbon. Three primates.
Gorrilas are primarily ground dwellers, Gibbons are primarily arboreal, while Chimpanzees spend significant amounts of time in trees and significant amounts of time on the ground.
The hominids did not suddenly evolve from tree-dwelling apes, they evolved from apes which, like chimps, already spent a significant amount of their time on the ground. So it was not a matter of developing for a terrestrial lifestyle while swinging around in trees, but a matter of developing a terrestrial lifestyle
further.