From very early in our history, humanity always had an appetite for sweets. Ancient civilizations knew certain honey/fruit mixtures as part of a meal or as an "inbetween".
There's enough evidence of ancient Egypt and Greece enjoying confection type of pastries. They usually consisted of honey, (dried) fruits, nuts or simple cookies with or without spices.
We are talking around the 5th century BC! But earliest sugar reports are from Indians on their trade routes to New Guinea around 8000 BC.
In the late Roman republic they would speak of "secundae mensae" (after-meal) as a course for the first time. It was more of a custom not everyone participated in.
This custom would disappear in time...
Later, in our part of the world, it was thanks to the crusades and plantations in medieval southern Europe that we discovered cane sugar.
From then on the process of experimentation and tool development resulted in a wider variety of sweet recipes.
It wasn't until this historical development that we started to consume more sweets. The term "dessert" was still non-existing.
Greeks and Romans knew about the existence of sugar contrary to popular beliefs. General Narchus of Crete got acquainted with sugar for the first time in India. In a region known today as Punjab. This was around 327 BC.
Different Roman scriptures, among them by geographer Strabo, desribed sugar as "stones with the color of frankinsense, sweeter than honey or figs."
They would call sugar the "Indian salt" for its similar appearance to salt. Even up until medieval times, ancients would still refer to it that way.
Both Romans and Greeks experimented with sugar and made different types of medicines but it wasn't broadly used for cooking. They actually preferred honey as a sweetener.
Roman sweet pastries were "dulcia" (close to the Spanish "dulces"). Oftentimes made with honey.
The Chinese and Indians already used sugar cane for various purposes. Indians however were the ones who knew how to produce granulated sugar.
Around the year 350 AD, not long after the refining process was discovered, the spread began over the Asian continent.
The Indian trade routes brought crystalized sugar to several parts of Asia, including China in the 7th century and soon-after, the Middle East.
That part of the world would become a hub of all sorts of sweet recipes. Often made with phyllo (filo) dough and also used in general cooking.
Although not as refined as we know it today, the old "lumpy" sugar wouldn't stop people from having that "love affair".
There was talk of sugar in medieval Arab cultures. Theirs however appeared to be of lower quality as entrepreneurs preferred India produced grains.
They would travel to the country to adopt the production process of crystalized sugar.
Important leaders of those times showed and interest for the relatively new ingredient.
They were partly responsible for the enormous cultivation of sugar cane which spread to southern Europe, to what is now Andalusia, Spain and southern Italy.
Andalusia developed into an important production hub in the 9th century. From these large plantation companies, cane sugar was exported to the rest of Europe.
The high price made it a product often reserved for the wealthy or for special occasions.
After the 1500's, in old culinary writings, there are a few depictions of the term "course". Namely: entry, main course and dessert.
However, desserts where limited in variety with mainly ice-creams and some choux paste or meringue based sweets.
Technological advances made sugar production cheaper.
Knowing the addiction factor of sugar, it wouldn't take long before pastry shops popped up in a lot of towns and cities. Places with mainly sweet recipes. In France they were called "Pâtisserie".
A specialized store offering a variety of pastries.
This era was also responsible for the wonderful classic desserts we still have today.
Over the years, new techniques and creativity would make these pastries in many cases more appetizing, more artsy if you will.
The popular ones - the traditional desserts - of today are actually the work of master pastry chefs of those times. Cravings for these sweets would generate an unstoppable demand. The development of new sweet recipes continued ever since.