Hello, my name is***** and I have over 20 years of experience as a veterinarian. I understand that you are wondering what causes crystal formation in a dog's urine.
Different types of urine sediment crystals form for different reasons. So there can be several reasons for crystals to form.
Some crystals form due to diet and the way dogs metabolize what they eat.
Infections can predispose to crystals forming as well, particularly struvite crystals.
Some crystals form because of metabolic or organ disease so a complete biochemistry profile should be checked to look for pri***** *****ver or kidney disease or hypercalcemia (high blood calcium). These changes in metabolism can change urine pH as well as waste products excreted through the kidneys, both of which increase the likelihood that crystals will form.
Some dog breeds (Dalmatians and English Bulldogs for example) have a different way of processing kidney wastes and so are predisposed to forming certain types of crystals (ammonium urates).
Dogs that don't take in sufficient fluids have more concentrated urine and thus may be more likely to develop crystals in their urine, so it makes sense that dogs with heat exhaustion will be more likely to have crystals in their urine.
Some toxins damage the kidneys or precipitate out in urine, for example dogs with antifreeze poisoning (ethylene glycol toxicity) will have crystals forming in their urine.
The most common types of crystals we see forming in dogs are related to urinary tract infections, changes in metabolism that affect the ability to process what is in the food and thus change waste products excreted in the urine, and breed related crystal formation.
Thus diet, treating underlying organ failure, and increasing fluid intake as well as manipulating urine pH so crystals cannot form is done to prevent them
I hope this information helps.