Just fetch or create the class instance, then append the students key to the students property
subject = MathClass.get_or_insert(key_name="math_101")
subject.students.append(some_student.key)
subject.put()
You should really check if the student is already in the property.
e.g. if not student.key in subject.students
Lots of error checking, etc... needs to go in here. and I would make that code a method of the class, ie MathClass.enroll, so you can just call subject.enroll(student)