If I share a canvas course from teacher A through commons and import it into teacher B course with it also transfer teacher A's students or just the content?
Canvas Commons allows teachers to share course content only. The list of enrolled students and any discussion posts, assignments etc that they submitted on the original course will not be copied into the destination course. There is some information on Commons here: https://community.canvaslms.com/docs/DOC-2046
It's also possible to use Canvas's content import functions to copy content directly from one course into another without publishing the content to Commons, if you have teacher access to both courses. Again, this only copies the content and not the student data. You can import an entire course or just specific items from that course.
There is some information on the import function here: https://community.canvaslms.com/docs/DOC-2676
Just to add to Steve's helpful response; you have all those options, plus you, or Teacher A may choose to export an archive that doesn't contain any student information, save it locally and the share it with Teacher B.
Retrieving data ...