When student accounts are created with bulk child accounts and no email addresses attached, the teacher should receive an email with all of the usernames and passwords. If you can locate this email (searching for some of the earliest emails involving a student username is usually helpful), you can see the usernames and passwords for the class.
If this is lost however, there's not a way to recover lost passwords unless the child has previously connected a parent account (in which case the parent controls the account settings).
You can create new accounts for the students and create your own passwords using the instructions here.
When creating accounts for students, add the parent email address (double checking to make sure it's correct - a lot of times these are entered incorrectly) so the parents will receive an email from Khan Academy inviting them to create an account as well. Note: the email attached to the account which creates the student accounts will be shared with the parents.
Write down or print the usernames and passwords for the student accounts. You can pass these along to the next teacher, although you should keep in mind that a parent can change the password at any time.
Note: Teachers do not have the ability to look up or change student passwords. It is the belief of Khan Academy that the ability to change passwords should be a right reserved for the parents/guardians of the student. Remember, you have a student for a year or two, but these parents/guardians will retain their role with the children beyond when the children leave your classroom.