In addition to Tom Au's answer on the Meiji Restoration above, is the break down of the central coordinating mechanisms of the Tokugawa or Edo Era that preceded the Meiji Era. In ca 1600, Japan was unified under a military regime (bakufu or Shogunate) led by the supreme military leader, the Shogun, Tokugawa Ieyasu who had his castle in Edo (now Tokyo). The system set up by the Tokugawa regime functioned for ca 260 years as a strict caste society. There were four castes (with the shogun and his top leaders above all four): samurai, peasant, craftsmen, merchants. There was one caste below, the untouchables or eta, who dealt with anything related to death including tanning.
Peasants comprised the vast majority of the population (ca 80%) and owned the land; the economy was based on rice production. Other commodities (barley, millet, soy, etc) were traded but rice was like gold today. Merchants were essential to moving goods around the country (including seeds and new technology for improving harvests) and developed skills in handling / storing commodities (including sake, silk, soy sauce, dried fish and items made by the skilled craftsmen). A money economy developed in the merchant caste and many of them became skilled in banking and a small futures market developed in Osaka. Over time, merchants accumulated wealth while many a high-class samurai went hungry. The Seven Samurai (Akira Kurosawa's 1956 film) depicts some aspects of the life at that time including the rigid caste system and masterless samurai (ronin).
By the mid-1800s the Edo system was increasingly strained: the top samurai caste (and those above them) owed massive debts to the bottom caste (merchants). In today's world, it is not unlike the power (that is money) that multinational corporations have/control vis-a-vis many national governments. In short, the Edo Period was ready to breakdown, and the arrival of Matthew Perry's Black Ships from the USA helped it along that path.
During the Tokugawa / Edo Period, high-ranking samurai became skilled at bureaucratic management of the complex rice economy. At the same time, many low-ranking samurai seized opportunities in the money (gold and silver) economy such as schemes to create more land through landfill so they then could become land owners and gained the option to become wealthy peasants. Some of the more impoverished samurai relinquished their samurai status altogether and became bankers and traders. Some of Japan's early zaibatsu (financial cliques organized as family-owned holding companies) were founded with a strict code of honor, such as the House of Mitsui, patterned on samurai society.
Skilled samurai and merchants became essential to the early organization of the Meiji Era. (In the mid-1800s, educated males were ca 50% of society, females ca 15%.) Many former samurai with bureaucratic knowledge created the new government and naturally the modern military. Many leading merchants helped create a modern financial system including a new central bank, the Bank of Japan. Edo Period Japan had been closed off to trade and influence from outside, and so to remedy that gap, various missions to learn about the world were initiated. The most famous of these was the Iwakura Mission lasting from Dec 23, 1871 until Sept 13, 1873. The main aims of the missions were to renegotiate the unequal treaties that Japan had been forced into with the US and many European countries and to learn about the technology, science, social and economic structures of those modern countries. The learning that was brought back to Japan influenced how the country was modernized over the coming decades. By 1900, for example, 90% of the population was enrolled in elementary education.