How do I load data from a single table to multiple tables & keep referential integrity
output alone is not going to work (easily) as you have two things going on   

insert into student (name) 
select distinct studentName  
  from table; 

insert into teacher (name) 
select distinct teacherName  
  from table; 

insert into studentTeacher(studentID, teacherID) 
select student.ID, teacher.ID 
  from table 
  join student 
    on student.name = table.studentName  
  join teacher 
    on teacher.name = table.teacherName;