Food spoilage can be boiled down into two (there's more but let's keep it simple) main things.
Microbial contamination and enzymatic (and chemical) degradation.
Basically. Bugs get into the food and make it go bad, or the cells in the food themselves start breaking themselves down.
Freezing works to stop both of these things.
The microbes that contaminate food can't grow in freezing temperatures (doesn't mean it dies, just means it can't replicate itself) so you're hitting the pause button on the microbial growth for a while. Or least slowing it down substantially.
The enzymes that would break down the food (either products of the microbes or present naturally in the food) also have ideal operating temperatures and they can't work if it's too hot or too cold. Freezing slows down their ability to work as well so your food therefore lasts longer.
To answer the second part of your question. Ice crystals will form in the food and this may change its consistency but the freezer itself won't make your food dangerous to eat.
I should also add that cooking some foods (e.g. rice) that contain bacterial spores (e.g. Bacillus cereus) actually wakes up the bacteria and they start producing a toxin. Not an issue if you eat it right away but if you leave it out for a bit then in the fridge before you freeze it, it might be long enough to produce enough of the toxin to make you sick!