I saw this message displayed on a programmable sign over a highway, prefaced by the notation “Georgia Law”.
Obviously, the message is
Turn on [your] headlights when [it is] raining.
The intent is clear, but the syntax is awful.
Syntactically, the implied subject of both the verbs “turn” and “rain” is “you”, so technically the sentence means:
Turn on [your] headlights when [you are] raining.
I don’t have any particular suggestion for how to “improve” the sign. Signs aren’t written in normal syntax because of space constraints, so any alternate version would have to be really short. Writing “If it is raining, turn on your headlights” is obviously longer and not obviously better, because even when space is not limited, we expect signs to be written in a terse style that lacks pronouns.