Mill is arguing that production, not consumption, is what generates wealth. He points out that it is a fallacy to conclude from the fact that an individual producer is better off if more people to buy his output, that everyone is better off if aggregate consumption is larger. He then distinguishes between unproductive consumption and saving, the latter of which provides a fund of consumption for workers who can then specialize in production without having to produce their own consumption goods. This process raises productivity and therefore, the wealth of people in the economy.
So if foreigners come to a country and buy goods for their own consumption, production overall is not stimulated. It is merely shifted away from goods with less demand toward goods with more demand.