See this first.
The following is of course simplified:
Suppose we have 100 colonists on mars. Each can produce a certain amount of various products. Products essential to life support include energy, water, food, breathable air, etc. These must be produced on average above 100% of the colonies requirements (above because dips below 100% means some casualties. A safe reserve must always be maintained.) Other items will also be in demand but could be produced at less than 100% of demand without loss of life.
Planners determine that each colonist needs X solar panels and storage batteries for there energy needs. If a colonist produces less than 100% of their life support needs they will have strong demand for more, meaning they will be willing to pay more for it. If they produce 100% they will still have some demand for more but will be price sensitive. If they produce more than 100% of their life support needs some will be available for industry and some for resale. The labor requirement for producing energy will be low; mainly the result of how many solar panels (or other means) they deploy. Any profits they have may be reinvested to produce an increased rate of production.
Unlike energy, food comes in varieties that encourage more trade opportunities. Some food is more storable while other food is more perishable. Basic farming using Zubrin's example would require about an hour of labor per day to produce more than 300% of the colonies needs. Even though colonists could produce more than 100% of their needs demand and trade will be strong due to the desire for variety. As farming becomes more efficient a lower percent of the colony will be engaged in it.
Supply, demand, labor and such will be similar for other items. The invisible hand, a principle that can hardly be denied, will insure that production meets need. Note that exports have not been mentioned because none are required for this model to work.
Suppose items A and B are essential and items C and D are not. Colonist zero spends various amounts of his time during the day producing 50% of A, 20% of B, 10% of C, and 40% of D. Note these are percentages of the colony's average individual demand. This is not 120% of the individuals production capability. It may be more like less than a quarter of that.
Colonist zero must buy 50% more of A and 80% more of B. Zero keeps 5% each of C and D and sells the rest. Assume zero has a reserve of A and B that are not part of this calculation.
The colony overall produces 120% of both A and B. It produces 50% of demand for C and D.
The price for A and B will be relatively low and kept there by competition. The demand for C and D means the price will be somewhat higher and those producing it will have an incentive to produce more.
In this situation colonist zero will have 99 potential customers (though not all for all products because some will obviously be sellers rather than buyers of some items.)
What happens if production of items C and D rise to meet demand so that colonist zero can no longer sell enough of C and D to pay for what he must have of items A and B? Either he will sell his labor or start producing item E (assuming s/he is already producing as much of A and B as s/he is capable.)
The bible principle is very simple... if they don't work, let them not eat.