This might be obvious to some, but this common slang phrase has its origins in the great navies of the United States and Great Britain.
If you have seen an old pirate ship in a movie or a modern yacht or even a canoe, you know that rope handling is an essential skill for becoming an accomplished sailor. Even the smallest water craft, at some point, needs to be tied to something so it does not drift away.
This skill is even more essential on the masted ships of yore. These ships had dozens of ropes and lines of varying composition and size, and they were used for a variety of different purposes. Ropes broke frequently and needed repair. New ropes need to be combined with old ropes, thick ropes to thin ropes, and so on.
Therefore, a sailor was considered inexperienced and unworthy, perhaps even dangerously clueless, until he had "learned his ropes." We use the phrase today with a similar connotation when a person is in a new situation and getting his feet wet or getting her bearings (yet more commonly used nautical slang).
As an aside, the US Navy calls the literal learning of one's ropes "marlinespiking." The term comes from the iron tool, a marlinespike, used to separate individual strands in a rope.