The major reason for this shift is that efficiency in the primary sectors of many world economies has increased. This makes a country’s primary sector more productive and frees workers up to do things in other sectors of the economy.
Traditionally, the primary sector of an economy has been very labor-intensive. In times past, a relative lack of technology would mean that huge numbers of people were needed to farm or to do things like cutting down trees. Today, technology has changed this. Machinery does so much of the work that large work forces are no longer needed.
Those workers (or at least their children) typically then move to the secondary and tertiary sectors of the economy. This often increases their quality of life since these sectors are often less physically demanding and will often have better pay than the primary sector does. As more people join these sectors, their children also have better opportunities to become educated. This, too, increases participation in the higher sectors of the economy.
Thus, it is mainly technological changes that have allowed workers to leave the primary sector so they can participate in the other sectors of the economy.