Steam engines had mechanical regulators that consisted of a pair of hinged lever arms with a ball on the end of each arm, as the engine sped up the centrifugal force caused the arms to raise up closing a valve. If you adjust the regulator so that the arms go to horizontal (with the balls pointing to the wall) without closing the valve you are not limiting the speed of the engine.
A very colorful phrase, one needs to be careful when using "balls to the wall". Although its real origin is very benign, mos people assume it is a reference to testicles.
In fact it is from fighter planes. The "balls" are knobs atop the plane's throttle control. Pushing the throttle all the way forward, to the wall of the cockpit, is to apply full throttle.
Origin: In aviation, the throttles (or power levers) are usually sticks with ball shaped ends. When a pilot wants full power, he moves the throttle forward towards the front wall of the cockpit. Thus, "balls to the walls" meant "full power".
Fast; hectic; pushed to the limits