Sugar was grown in Crete and Cyprus in medieval times - the Arab sugar plantations and manufactories on Crete were continued by the Byzantines when the re-captured the island, and by the Venetians (who might have given the island the name Candia due to its sugar production) and then the Ottomans were run by slave labour and produced quite a nice profit.
Sugar was thus a luxury good in the Mediterranean, and common for those that could afford it.
Sugar started to become more common, especially in northwestern Europe after the Netherlands, England and France colonised the Lesser Antilles and made these islands into the famous sugar islands. Sugar production increased in the 17th century, and by 1700, the British West Indees alone produced 25 000 tons of sugar yearly while Portugese Brazil produced 20 000 tons, the French sugar islands 10 000 tons and the Dutch sugar islands 4 000 tons.
Around this time, sugar becomes cheap enough that most people can have sugar, even if it is still a seldom eaten luxury for regular people.
The sugar islands pretty much forced the sugar plantations in Crete and Cyprus, North Africa and the Levant out of business. However, the continental blockade during the Napoleonic Wars deprives much of Europe of colonial goods, including sugar, and sugar beet refinment is introduced as a replacement.
By the time of ww1, sugar beet sugar has replaced cane sugar as the main source of sugar in northern Europe.
For example, during ww2, in 1942, when Swedish rationing was down to its lowest, the daily ration was;
22g meat and pork.
4g cheese.
36g fat (oil, butter, cream etc).
3g coffee.
170g flour.
67g sugar.
8 eggs per month.
Note that despite the low rations, sugar beet production allowed a ration of 67 grams of sugar per person and day. Note that potatoes, milk, fruit and vegetables (only available in season) and fish (only available to a limited extent) as well as wild game, mushrooms and berries (all also only available in season) were not rationied.