I imagine the expression comes from old-fashioned sailing ships.
These ships have lots of sails, and lots of ropes to manipulate the sails and steer the ship and raise/lower the anchor.
"Learning the ropes" is learning the craft of sailing the ship successfully.
It is then applied metaphorically to any business.