Although sugar and candy ultimately have Persian or Hindi origins, all three words (including syrup) appear to enter various European languages from Arabic. The timeline for the appearance of these new words in Europe also appears to be Medieval. This seems too coincidental. Was there an active sweets trade between the Middle East and Europe during the Middle Ages, or did these words appear in Europe after the crusades, or is there some other explanation?
So first, you should read Sidney Mintz's Sweetness and Power. It is one of the first 'commodity studies' and traces the complex history of sugar and its relationship to the political economy of the past.
Second, you need to remember that Arabic was a language of Europe (in both the east and the west there were Arabic speaking polities well into the 15th c.) So it shouldn't be that surprising that we see borrowing especially between Arabic and Romance languages because they coexisted side-by-side in Europe for centuries and through commerce for even longer.
Third, the connection to sugar. I'll offer a brief summation of part of Mintz's study. Sugar particularly that made from processed sugar cane came to Europe via the Muslim world. Sugar cane was native to south Asia and its production into syrup, crystalized sugar, and candies all developed primarily in Arabic speaking countries.
There was certainly a trade in sugar to Europe during the late medieval period, but it was incredibly rare and very expensive. So in say the 12/13th century it was used more as a seasoning like salt than a sweetener or a primary ingredient. It would not be surprising then that the words for those uses were borrowed pretty directly from Arabic.
What is interesting about sugar is that by the 15th c. It was being grown in the southern latitudes of Europe. The Algarve of Portugal, parts of southern AndalucĂa. I believe it was also being grown on some Mediterranean islands and southern Italy. But it is very labor intensive and requires a sizable investment in both labor and capital improvements (milling technology). So the overall volume of sugar production remained low through most of the 15th c. The major change in sugar production came with the link between African slavery and plantation production. As early as the mid-1400s the Spanish and Portuguese began to use enslaved Africans acquired by Portuguese merchants to intensify sugar production and expand it to places like Madeira, the Canaries, the Azores, Sao Tome, Cape Verde, and eventually the Americas. By the time you get to early 17th c. Brazil sugar is now being grown on a cycle that allows for almost continuous harvesting during 10 months of the year. This demanded huge amounts of labor to maintain the fields and more importantly, manage cutting cane and transporting it to mills for processing. Once the sugar cane is ripe and harvested, it can 'sour' (ferment) within hours. So to maintain production plantations needed to cut, transport, grind, reduce sugar cane from plant to pulp non-stop for the majority of the year. This was done by using human labor in the form of enslaved Africans. In the major sugar producing regions of the Americas, the life expectancy for an enslaved person working on sugar was dismal, quite possibly a year or less, certainly no more than a couple years.
As Mintz points out, the steady increase in sugar production never sated appetites for it (and arguably we still haven't sated our appetite for sugar even if most 'sugar' is now coming from corn or beets). We just found new ways to use it in ever larger volumes.