How it began
Sugarcane was carried to India by Austronesian traders by around 1000 BCE. According to Wikipedia's history of sugar, the first credible written evidence for granulated sugar dates to ancient India, and around 350 CE Indians discovered methods of turning sugarcane juice into granulated crystals. The Sugar Association gives the same date and places the first crystallization in the Gupta dynasty. A history published by The Conversation puts the first boiling of cane juice into crystals earlier, at around 500 BCE in India. The sources agree on the place and differ on the date.
Before it existed
Before the crystal process, sugarcane was used as cane and as juice. In the Indian medical tradition the plant was known as ikshu and its juice as phanita. Sanskrit works transmitted orally from about 1500 to 500 BCE contain the first references to cultivating sugarcane and making sugar in the Indian subcontinent. Wikipedia notes that sugar remained relatively unimportant until the juice could be turned into crystals, because crystals were easier to store and transport.
How it spread
By the sixth century CE sugar cultivation and processing had reached Persia. Indian refining was a technology that other states sent missions to learn: Chinese documents confirm at least two missions to India, initiated in 647 CE, to obtain the technology for sugar refining, and China established its first sugarcane plantations in the seventh century. Between 900 and 1000 CE cane cultivation spread to the eastern Mediterranean, in Cyprus, and to East Africa, in Zanzibar.
What lasted
The vocabulary of sugar still carries its Indian origin. In Sanskrit the crystals were called khanda, which is the source of the word candy. The word sugar is thought to derive from the Sanskrit sharkara, meaning ground or candied sugar and originally grit or gravel. Granulated crystals turned a perishable juice into a durable commodity that could be stored, carried and traded over long distances.