The Quran says that whoever saves one life, it is as if he had saved the life of all mankind. On this basis the International Islamic Fiqh Academy, a body of scholars from across the Muslim world, ruled in 1988 (Resolution 26) that a living person may donate tissue that regenerates, such as blood or skin, while it is forbidden to take from a living person a vital organ like the heart. The Academy also allowed taking organs from a deceased person when they are needed to save another's life or restore an essential function, with the consent of the person before death or of the family. Many scholars and national fatwa bodies also allow a living person to give one kidney, since the donor can live well with the other, provided the risk is low.
The Academy stated that organs must never be sold. It also recognised death as established either by the complete and irreversible stop of the heart and breathing or by the complete and irreversible stop of all brain function, a point on which some scholars still disagree and prefer to rely on the stopping of the heart and breathing. Those who object to donation more generally cite the honour that is due to the human body, even in death, and the belief that we do not own our bodies, but these are the minority views among contemporary scholars.
The Prophet ﷺ said that when a person dies his deeds end except for three: ongoing charity, knowledge that benefits others and a righteous child who prays for him. Many Muslims see organ donation as a form of ongoing charity. If you are considering it, you can state your wishes to your family clearly, because their consent is often part of the process, and ask a local scholar if you have a specific question about your situation.