Linotype machines were well established by that point. The way they justify text is with spacebands, wedge-shaped widgets inserted at word breaks during composition. After the operator completes each line, the justification vise squeezes the spacebands up until the line expands to the appropriate width before it’s cast. (If the composed line is too short this process can fail, potentially dumping molten lead all over the place.)
Alternately they may have used a Monotype machine, which (per Wikipedia) uses a two-step process (with a paper tape intermediate) and can therefore calculate the necessary justification after the fact, though I don’t know the exact mechanism by which this was done.
Mechanical processing was incredibly clever; these days everything can be done with a couple microchips but the heights that were achieved with mechanical linkages are absolutely astonishing.