Body-axis elongation constitutes a key step in animal development, laying out the final form of the entire animal. It relies on the interplay between intrinsic forces generated by molecular motors1-3, extrinsic forces exerted by adjacent cells4-7 and mechanical resistance forces due to tissue elasticity or friction8-10. Understanding how mechanical forces influence morphogenesis at the cellular and molecular level remains a challenge1. Recent work has outlined how small incremental steps power cell-autonomous epithelial shape changes1-3, which suggests the existence of specific mechanisms that stabilize cell shapes and counteract cell elasticity. Beyond the twofold stage, embryonic elongation in Caenorhabditis elegans is dependent on both muscle activity7 and the epidermis; the tension generated by muscle activity triggers a mechanotransduction pathway in the epidermis that promotes axis elongation7. Here we identify a network that stabilizes cell shapes in C. elegans embryos at a stage that involves non-autonomous mechanical interactions between epithelia and contractile cells. We searched for factors genetically or molecularly interacting with the p21-activating kinase homologue PAK-1 and acting in this pathway, thereby identifying the α-spectrin SPC-1. Combined absence of PAK-1 and SPC-1 induced complete axis retraction, owing to defective epidermal actin stress fibre. Modelling predicts that a mechanical viscoplastic deformation process can account for embryo shape stabilization. Molecular analysis suggests that the cellular basis for viscoplasticity originates from progressive shortening of epidermal microfilaments that are induced by muscle contractions relayed by actin-severing proteins and from formin homology 2 domain-containing protein 1 (FHOD-1) formin bundling. Our work thus identifies an essential molecular lock acting in a developmental ratchet-like process.