"The minor leagues did not start out as what they are. By a long series of actions and agreements, inducements, and rewards, the minor leagues were reduced in tiny degrees from entirely independent sovereignties into vassal states, existing only to serve the needs of major league baseball."
-Bill James, The Bill James Historical Baseball Abstract
The minor leagues as we know them today really didn't exist in the 1800s. The Cincinnati Red Stockings, history tells us, were the first professional team, founded in 1869. For much of the following decade, a steady succession of leagues started and folded, sometimes in the same season. Franchises were founded in all of the major (eastern) U.S. cities, along with teams in not-so-major cities like Troy, NY, Keokuk, Illinois, and Mansfield, Ohio. In an attempt to rule out the weaker teams in financial and competitive terms, the National League was formed in 1876. Despite this exclusivity, teams outside the NL considered themselves to be very much in competition with those in the first major league, both in terms of revenue and players.
For much of the remainder of the century, that competition only intensified. There was no agreement or affiliation between teams at the different ends of the competitive spectrum. There was no method of "calling up" a player from a "farm team" (that term didn't come into use until the 1930s). If a National League wanted a player from, say, the New York State League, they simply purchased that player from the team involved, or worked out a trade. This arrangement continued until well into the 1920s, when the then International League Baltimore Orioles dominated minor league play.
As the game became increasingly popular in the 1870s, players were able to demand and receive correspondingly higher salaries. In an attempt to keep the salaries in check, the National League instituted the Reserve Clause, which allowed them to retain the services of a player from year to year (thus preventing players from "team hopping"). This, of course, also kept teams from lesser leagues from bidding on those players. The Reserve Clause withstood numerous challenges from rival leagues and the courts, until the famous Curt Flood case of 1969.
Over the 1880s and 90s, more and more teams and leagues outside the realm of the National League signed onto the National Agreement, which was entered into by the NL, the rival American Association, and the Northwestern League (which was briefly considered one of baseball's first minor leagues) in 1883. This brought some relative peace and stability to organized baseball, until the fiery Ban Johnson took over control of the Western League in 1893. In 1899, the National League decided to terminate franchises in Baltimore, Cleveland, Louisville, and Washington. The Western League scooped up those vacancies, although they were still considered to be a lesser league than the National. Shortly after this, however, the Western changed its name to the American League, and declined their participation in the National Agreement. This started a heated bidding war between the two leagues for players, as the American League didn't respect the National's Reserve Claus.
With the raiding of rosters heating up, teams in lower level leagues began to be concerned for their future, as the salary escalation at the top of the ladder would likely put increased pressure on the bottom lines of the teams and leagues on the lower rungs.
The National Agreement of 1903 ended the war between the two leagues, and set in place rules for the acquisition of players from other leagues. Lower levels teams would now be fairly compensated for the players they had taken the time to scout and develop. And those teams didn't have to sell their players if they didn't want to - but they often did, as such sales were important to teams' financial stability, especially during difficult economic times. The original agreement included 96 teams across 14 leagues, and organized the leagues according to level of competition, with Class A the highest, and Class D the lowest.
The "minor" leagues still didn't really exist at this point - this was a term used mostly by reporters from major newspapers. Lower level teams still viewed themselves as independent businesses, and in this time before mass communications, they had intense followings among local fans. There still was no formal agreement between leagues - the "major" league teams preferred to leave the "minor" league teams to the task of finding and grooming young players..
With the stability created by the new National Agreement, the minors were set for a long period of prosperity.