Hillside Primary School in Headfield Road, Newsome, Huddersfield, sent a letter to parents on Tuesday following the incident on Newsome Road.
The letter from Nadine Sadler addressed to parents and guardians said: "We have been informed today that there was an incident on Monday morning of a man exposing himself on Newsome Road.
"This incident has been reported to the police and Safer Kirklees.
"This is obviously very worrying for everyone. I have spoken to the older children who may walk home without parents about how to keep safe.
"Please can you all take extra care to ensure pupils are not walking home or playing out alone, and inform the police and school if you see anything that is of concern."