It appears that my original query was correct:
teacher.students.group("assignments.student_id").order("MAX(assignments.updated_at) DESC")
I had thought it wasn't working because I had written a bad RSpec test that was failing because I wasn't handling the timestamps well. Once I used Timecop to handle the timestamps properly, the test passed.
Sorry about that.