The phrase "supply and demand" was first used by James Denham-Steuart in his Inquiry into the Principles of Political Economy, published in 1767. Adam Smith used the phrase in his 1776 book The Wealth of Nations, and David Ricardo titled one chapter of his 1817 work Principles of Political Economy and Taxation "On the Influence of Demand and Supply on Price".
In The Wealth of Nations, Smith generally assumed that the supply price was fixed but that its "merit" (value) would decrease as its "scarcity" increased, in effect what was later called the law of demand. Ricardo, in Principles of Political Economy and Taxation, more rigorously laid down the idea of the assumptions that were used to build his ideas of supply and demand. Antoine Augustin Cournot first developed a mathematical model of supply and demand in his 1838 Researches on the Mathematical Principles of the Theory of Wealth.
During the late 19th century the marginalist school of thought emerged. This field mainly was started by Stanley Jevons, Carl Menger, and Léon Walras. The key idea was that the price was set by the most expensive price, that is, the price at the margin. This was a substantial change from Adam Smith's thoughts on determining the supply price.
The model was further developed and popularized by Alfred Marshall in the 1890 textbook Principles of Economics. Along with Léon Walras, Marshall looked at the equilibrium point where the two curves crossed. They also began looking at the effect of markets on each other.
Since the late 19th century, the theory of supply and demand has mainly been unchanged. Most of the work has been in examining the exceptions to the model (like oligarchy, transaction costs, non-rationality).