Can we use students' class homework solution for research purpose?
You need to run this by your Institutional Review Board (IRB), as you would any time you use data from human subjects for research.

From what you describe, it has a good chance of qualifying for an IRB exemption under one of these categories (if identifying information is removed before giving the data to the researcher):


It is using existing data
the data comes from normal educational practices


but even then, the IRB needs to be the one to make that determination.