The Sunni schools and Imami schools differ on this with regard to egg donation. Originally, both the Sunni schools and Imami school considered that fertilisation of an egg between non-mahrams is zina and therefore haram. The scholars of the Imami school said that to solve the problem, a man can do temporary marriage with the egg donor, even though there is no physical relationship between them.
Scholars of the Imami school have now changed, and ruled that egg donation and fertilisation between non-mahrams is not haram because zina involves the physical relationship. Therefore egg donation is permitted.
Sperm donation among both Sunni and Shi'i schools was also considered haram because a woman cannot both be married to her husband and to the sperm donor at the same time; the majority of Imami scholars still rule that sperm donation is prohibited because of the importance of the lineage of father in the child's life and most clinics prohibit any information about the identity of the child's father being given until the child is eighteen. However, Ayatollah Khamenei has now permitted sperm donation, as it is not classed as zina.
While sperm and egg donation may be now technically allowed in the Imami school, there are still ethical considerations to bear in mind, the most important being the well being of the child and the child's sense of identity. Islam recommends that a person check the family of a potential spouse carefully, going back, if possible, seven generations. Bearing children with unknown donors is risky. Many children born of unknown donors are now starting to speak out about their anguish and pain at not knowing who their real parents are. Therefore, the Qur'anic injunction about calling adopted children by their real paternal names and not concealing their true identity shows the sensitivity and consideration for the child's sense of identity.
If Muslims are to engage in egg donation, it may be best to seek a donor from a mu'min family who will be known to the child. Donors have to go through health checks with a clinic to clear for donation. Likewise for sperm donation. Children born of sperm donation are now tracing their siblings and meeting them. One man fathered eleven children with different couples and these children have now all traced each other. This shows that blood relations are still considered of huge importance even among non-Muslim children, and that an egg or a sperm is not just a 'bunch of cells' as many clinics claim.