Macromolecular protein complexes perform essential biological functions across life forms. The assembly of such complexes is known to be regulated at the level of gene transcription, but little is known about the factors that control their assembly once the mature protein subunits enter their target space (cytoplasm, membrane, or cell wall). Even less is known about how their assembly is regulated by extracellular signals from the environment. The bacterial flagellar motor is a large macromolecular machine that powers motility in bacteria. The torque-generating stator units of the motor assemble and disassemble in response to changes in external load. We used electrorotation (applying high frequency rotating electric fields) to drive tethered cells forward, which decreases motor load, and measured the resulting stator dynamics. No disassembly occurred while the load remained high, but all of the stator units were released when the load on the motor was reduced by spinning it forward at high speed. When the electrorotation was turned off, so that the load was again high, stator units were recruited, increasing motor speed in a stepwise fashion. A model in which speed affects the binding rate and torque affects the free energy of bound stator units captures the observed stator assembly and disassembly dynamics, providing a quantitative framework for the environmentally regulated self-assembly of a major macromolecular machine.