The best thing to prevent urinary tract problems in cats is to feed them canned food and encourage water intake. Cats by nature have very concentrated urine. By diluting the urine the crystals are less likely to form. The way to make the urine more dilute is to have the cat ingest much more water. Cats don't typically drink a large amount so feeding food with a high water content such as canned food will help. Add water to the food, get a water fountain, offer multiple water dishes filled to the brim throughout the house can also help.
It is recommend to feed a diet low in magnesium if the cat has a history of struvite crystals. However there are other types of crystals as well that do not need a low pH which is produced in many of the "urinary tract health" diets you find at the pet store. If your cat does has a history of crystals, there are also veterinary diets made by Purina and Royal Canin that seem very palatable to most cats.
I hope this helps.
A related discussion, Need nutritional info for bladder stones was started.