All perfect praise be to Allah the Lord of the Worlds. May His peace and blessings be upon Prophet Mohammad and upon all his family and companions.
The sale of sperm, as well as donating or using it for purposes other than between a married couples, is prohibited. This is because it violates the objective of preserving lineage, and it goes against ethical principles. The preservation of lineage is one of the major objectives in Islamic law, as it is one of the necessities that the Sharia has commanded to protect and maintain. Lineage is a blessing granted by Allah to His servants, as Allah The Almighty Says (What means): "And it is He who created from water a human being and made him [a relative by] lineage and marriage. And your Lord is competent [concerning creation]." [Al-Furqan/54]. Marriage is established as a means to preserve lineage, allowing genetic traits to be passed between spouses to their children. Therefore, the sale, donation, or use of sperm for purposes other than between a married couples is prohibited. And Allah The Almighty Knows Best.