RAW is unclear
I could not find any wording in transformation abilities (polymorph, wild shape, etc.) or in the list of conditions that explicitly states that the conditions go away if you become immune to them.
DM rulings are necessary because conditions are so varied
The different conditions are so varied that I don't think there can be an overall answer for all of them.
For example, consider the prone condition. If the druid is prone, and wildshapes into an air elemental, he would intuitively not be prone anymore, since he becomes a "funneling cloud of whirling air". When he returns to his humanoid form, it doesn't seem to make sense that he would return to a prone position. This logic seems to apply to a lot of the physical restraint conditions, such as grappled or restrained.
On the other hand, consider something like poisoned or blinded. The wildshape text states,
When you revert to your normal form, you return to the number of hit points you had before you transformed.
This suggests that wildshaping doesn't repair your original body at all. Since you don't get any HP back from ending your wildshape, it seems like wildshaping wouldn't clear the poison or exhaustion from your original body (one could argue the poison point, I suppose).
Finally, there are mental conditions like charmed or frightened. Given that you don't forget what's going on when you change forms, it seems intuitive that you stay charmed or frightened when you wildshape.
All of these arguments are very weak. It's a good idea to get rulings ahead of time
None of the assertions I made above have much support in the rules. My point is that there aren't clear rules, and rulings aren't obvious. If you think that this problem is going to be significant, you should probably discuss this with your DM and come to a conclusion on these conditions at the table.