Its driven by tongue weight and speed. The back shocks can't dampen the oscillations out, the whole thing starts rocking back and forth, and it devolves to the point of uncontrollable.
You either need stiffer springs, way more dampening, both which destroy unloaded ride quality, less tongue weight, or less speed.
This happens all the time towing my boat with my 2500. My friends F350 with the same wheelbase and the same boat can tow the same road at much higher speeds than my truck with no oscillations. Mine will start porpoising horribly over 57 or 58 mph. He can tow it any speed he wants on the same stretch with zero porpoising.
The difference is he is nowhere near max weight and has stiffer leaf springs. Mine is like 3 pounds below GVWR with coils.