To get one's ducks in a row essentially means to ensure all of the small details or elements are accounted for and in their proper positions before embarking on a new project. A defense attorney, for example, may spend much of his or her time making sure all of the evidence and witnesses are presented in a precise, effective order. A salesman may get all of his or her "ducks in a row" by rehearsing his sales presentation beforehand. When a person is fully prepared for any eventuality and has every element in place, he or she can indeed be said to have his or her ducks in a row.
Etymologically speaking, your guess as to the origins of this saying is about as good as any other. There are at least three plausible theories surrounding the origin of "get your ducks in a row," plus some others which, at least, put up an interesting argument. Some sources suggest the phrase was not even used in print until the late 1970s, although a magazine article from 1932 did suggest "getting our economic ducks in a row."
The most popular theory suggests that "ducks in a row" came from the world of sports, specifically bowling. Early bowling pins were often shorter and thicker than modern pins, which led to the nickname ducks. Before the advent of automatic resetting machines, these "duck pins" would be manually put back into place between bowling rounds. Therefore, having one's ducks in a row would be a metaphor for having all of the bowling pins organized and properly placed before sending the next ball down the lane. Many bowling alleys still offer "duck pin" lanes with smaller bowling balls and shorter pins.
Another theory comes from the world of nature. Mother ducks often corral their young offspring into manageable straight lines before traveling over land or water. Any stragglers or escapees would be noticed as long as the integrity of this line is maintained. The idea of getting all of one's ideas or ingredients or team members in one organized line would be similar to a mother duck getting all of her literal ducks in a row. One concern with this theory is the use of the word ducks, since baby ducks are more correctly identified as ducklings or even chicks. The common expression suggests adult ducks, not necessarily younger ducklings.
There are also sources which argue the "ducks in a row" element refers to a carnival game or two. One popular carnival game involves the player using a small caliber rifle or air gun to knock down moving targets. Quite often these targets are in the shape of ducks, and a conveyor belt system makes sure the duck targets are aligned in a consistent row. It is possible that the expression came from the benefit of having all of the targets (ducks) arrive in a predictable and organized order.
A different carnival game uses plastic ducks which float in a water-filled track as players attempt to select the ones with high-value prize codes hidden underneath. These plastic ducks are generally presented in a moving row for easier selection by the players.
It is also possible that the expression came from the natural flight formation of ducks as they move through the sky. The most efficient arrangement is a V-formation behind the leader, which allows each duck to take advantage of reduced wind resistance. Having all of one's metaphorical ducks in a row would be just as efficient and logical as flying in such an organized formation.