Can public schools lower a student's grades as a punishment for not participating in an activity that could harm the student's health?

It would be unusual, but as far as I know there's not actually a law against it.

Note also that there's a difference between "punishing a student by lowering his grades" and "giving the student the grade he has earned." If participation in the activity was worth 100 points and the student does not participate, the net effect of losing those 100 points will be to lower the student's grade, but this is NOT "punishment".