This professor is behaving illegally. Your son should tell the Office of Disabilities or a dean or perhaps it would be easier to get the professional who diagnosed him to get involved. This is horrendously inappropriate, to deny him support.
If he is not doing well and is unhappy he would be eligible for a medical withdrawal with this diagnosis and that would wipe the slate clean in terms of grades. I don’t know if that is relevant. He could also withdraw from that one class and NOT get a W. He should NOT get a W for any classes he withdraws from for medical reasons.
If he was just diagnosed, going home for treatment, meds and learning tools for handling his OCD, would be helpful for the long term. Often anxiety makes OCD worse of course.
A higher up needs to tell this professor to act legally and appropriately. Are you sure the professor got the letter?
Please don’t let this slide. It is appropriate for you to get involved with deans or other higher ups in a case like this.