I'm sure you will be able to determine the proper response, but my first inclination is to suggest that you talk to him, explaining why private parts are to be kept private and do nothing more than that. Along with the explanation, you could tell him that, if he does it again, there will be consequences. Right now, he may not even realize what he did is wrong. I remember drawing an anatomically correct picture when I was around the same age. (Did I forget to mention that I drew the picture in Sunday School!?!) Until someone told me I shouldn't do that, I didn't know.
If he repeats the behavior, you should act quickly, but right now, I wouldn't worry too much about it UNLESS YOU BELIEVE THERE IS A POSSIBILITY THAT YOUR SON HAS BEEN MOLESTED. If that is the case, please get counseling for him as soon as possible. When you have the conversation with him about "keeping private parts private", you might also ask him if anyone has touched him inappropriately. Don't make a big deal about it, but also mention that we don't touch other people in their private parts and that he should tell you if anyone ever touches him in that way. Then ask him if that has ever happened.
Don't be alarmed. Most likely, nothing has happened. He is most probably just repeating the behavior that was done to him by the other child. If he never exposes himself again, and he assures you that no one has harmed him, I wouldn't worry about it.
I've said a prayer that you will know the right way to handle this and that your son will be a happy, healthy and normal little boy. Enjoy him. He is a blessing!