In the name of Allah, the inspirer of truth. All praise is to Allah, Most Merciful and Compassionate, and all blessings and peace to our Master Muhammad, his family, companions, and those who follow them.
The Islamic Fiqh Academy, and other bodies, including Al-Azhar's Fatwa Committee, have studied this matter at length. They concluded that artificial insemination is permitted, as long as only the husband and wife are reproductively involved. This is permitted whether the fertilization itself occurs inside or outside the woman. It is not permitted to use third party ('donor') sperm or eggs, even when either spouse is infertile. They stressed that one should ensure that such procedures are carried out in a safe way, for obvious reasons.
Some of the scholars emphasize, too, that such procedures should only be used when normal means prove ineffective.
It is important, in the end, to remember that while we have been commanded by Allah Most High to take all permitted means, we have also been commanded to believe that means themselves do not have an effect; only Allah does.
And Allah knows best.
Answered by Sidi Faraz Rabbani of the Hanafi fiqh list.