The question would very much depend on what organ is being transplanted.
For example a heart is only able to be transplanted when the donor's body is still functioning and the heart is still beating, in other words the donor is brain dead (which would get you into the big machlokes haposkim regarding the definition of death with most American poskim including Harav Mordechai Willig (Av Bais Din of the RCA), Harav Hershel Shachter (Rosh Yeshivah of YU and head posek for the OU) and many others saying that such a person is still alive. On the other side you have Harav Avraham Steinberg Harav Yehoram Ulman and the Rabanut of Israel).
If the donor is alive then you would obviously not be able to kill a living person even if its to save a life as it says in the talmud sanhedrin 74a "Who is to say that your blood is redder than his, Perhaps that man’s blood is redder". This logical reasoning is the basis for the halakha that one may not save his own life by killing another.
If the patient is dead then and it's for saving a life, you run into the machlokes: the Minchas Yizchak chelek 5 siman 7 ois 22 and the Tzitz Eliezer chelek 13 siman 91 ois 5-6 say that its not allowed while Minchat Shlomo Tinyana siman 86 ois 5 says that one has to even against the family's will.
If it's not going to save the patient's life then it's a lot more complicated as quoted by the Nishmat Avraham YD page 526-529.
see here about the opinions of brain death:
https://www.jewishvirtuallibrary.org/the-brain-death-controversy-in-jewish-law
here is a video of Rabbi Ulman And Rabbi Steinberg discussing organ transplants: https://www.youtube.com/watch?v=osvmz3eCnr4