The importance of the cold chain in the food and the pharmaceutical industry
Avoiding cooling  again after keeping it ( for non critical products ) at room temperature is mainly to prevent forgetting it was not cold all the time and that it may not last as long as expected.
Taking food from the fridge, you may not remember after a week or two that it was outside longer than it should have been. It can violate the safety by growth of microbes, which does not fully stop when it gets cold again.
For drugs or similar critical products, it violates stability and guarantee of usability, as thoroughly described by @Julian answer. I did  related analysis within drug stability studies in past as well.
Food freezing is another case. Industrial freezing of food is done by shock freezing using liquid nitrogen. This leads to quick forming of small ice crystals that do not puncture the cell walls, so after melting food before usage, it is OK.
But when refrozen back e.g in a freezer, freezing is slow, leading to growth of large ice crystals puncturing the plant/animal cells. After another melting, cell liquids leak out, cells lose their tonus and the food gets unpleasant mechanical and sensory state, affecting the final taste. Additionally, what was told above about the fridge applies here as well.
Presence of free ice along with frozen vegetables is a sign the content was refrozen.
Slow melting of previously shock-frozen stuff leads to growth of bigger crystals, similar to recrystallization, as bigger crystals are thermodynamically preferred due to lower surface energy. So some cell wall tearing and subsequent deterioration of the content happens even during melting and continues until content is frozen again. Also, shock freezing still induces some stress on the product, even if lower than slow freezing.
So the final effect of

fast freezing -&gt; slow melting -&gt; slow freezing -&gt; melting

can be much worse than just

slow freezing -&gt; melting

as the former has more time and opportunity to cause damage.