Let's get a little nerdy for a second and explore the chemistry behind sugar. It turns out that sugar is made up of tiny molecules that are super good at attracting water. And when they do, they start to bond together, forming a hard, crystalline structure. It's like a little sugar party in there, but not exactly what you want when you're trying to bake!
Now, you might be wondering, is it still safe to use? The answer is, generally, yes! Hard sugar might be a pain to work with, but it's still perfectly edible. Just be sure to check the expiration date and make sure it doesn't have any off smells or funny flavors. And if you're feeling fancy, you can even try to revive it by placing the bag in a dry spot or using a dehumidifier.
Hard Bag Of Sugar at Christopher Ardoin blog