A metaphor that belongs to a Metaphor System of `Progress Is Forward` or perhaps `Effort Is Speed` and `Time Is Stationary And We Move Through It`.
The literal meaning is “all-out effort.” Its origin, according to two sources I’ve seen, is in aviation, specifically old-style throttle assemblies:

A old-timey throttle assemly. Image via WordOrigins.org
“First attested in the 1960s in the context of aviation, in reference to ball-shaped grips on an aircraft’s engine control (typically throttle, prop pitch, and fuel mixture). Pushing these ‘balls to the wall’ would put the aircraft at maximum thrust.” – Wiktionary
(The quote doesn’t say, but the “wall” here is the plane’s control panel in front of the pilot. A correspondent told me that, in the full forward position, the throttle would actually touch the panel: balls to the wall.)
Now, it’s easy to imagine aviators inventing that catchy, semi-rhyming term from their own experience flying, then using it metaphorically in other situations calling for maximum effort, and having the phrase spread until now it’s used by people who have no clue about its origin.
In keeping with the Kludge Theory of Metaphor, this metaphor will evoke the Balls Are Masculine metaphor for many people.