The oven is descended from a flat rock and an upside-down pot. Thousands of years ago, cooks would build a fire on a hearthstone, brush away the ashes and then put what they wanted to cook--usually a flat, tortilla-like bread--on the now-hot stone. But they realized that a lot of heat was wasted this way, so they started covering the food with a clay pot.
We can watch this haphazard arrangement developing into an oven in Egyptian archeological sites. First the stone hearth is replaced by a clay hearth, then the heat-retaining pot becomes a hood permanently affixed over it (this made for better cooking because the fire now heated the cover too) and finally you have the classic bread oven, in which a fire is built in a hollow area to heat a surrounding mass of clay or brick.
The bread oven is a fairly massive structure, and not many homes have ever had their own. Traditionally, only bakers had ovens, though they might rent out space in them after the day's bread-making for people who wanted to cook roasts or stews overnight.
As the world got more prosperous in the 18th and 19th centuries, more and more people wanted the luxury and convenience of their own ovens. The modern iron range (first heated by coal, then by gas) was then developed.