A lot of crystal, and subsequent stone formations, have to do with how acidic/basic the urine is. That being said, sometimes stones can form in a bladder with no crystals found to show up in the urinalysis either. This just happened in a patient we had yesterday, thankfully the owner allowed us to take radiographs because the dog was full of stones, and historically had struggled with crystals for the last year or so. It does totally depend on the kind of crystal formed what type of diet will help- some are due to more acidic or some more alkaline urine. Regardless, drinking lots of water will help dilute the urine, and so not being as concentrated, the urine is less likely to form crystals. There are prescription diets that help dissolve stones by changing the urine's pH, and there are diets that help maintain pH at a level where crystals will not form or the likelihood is decreased depending on what the issue is.
I had a cat that was diagnosed with cystitis or a bladder infection and formed crystals about 3 years ago when she was only 2 years old for who knows what reason, and the Dr. recommended she be on Hill's C/D for the rest of her LIFE

shocked

. I knew I couldn't afford it, and that c/d was s***, so I asked about homemaking her food. I went raw with her and her partner in crime companion for a spell, and they have never done better. That being said, I switched them back to high quality kibble for time and finance reasons. I always add water to their kibble, and add wet food as well to help them keep hydrated.