A widow has been allowed to extract her dead husband's sperm a day after he took his own life following an urgent West Australian court hearing.

The woman, known only as Ms C, and her husband had been trying to conceive for the past two years and began in-vitro fertilisation (IVF) treatment before he committed suicide.

His body was taken to Sir Charles Gairdner Hospital on Friday. Ms C asked for his sperm to be removed and stored for future IVF procedures.

Her request was denied and she was told she needed a court order.

Justice James Edelman heard the matter on Saturday evening and said the Human Tissue and Transplant Act allowed designated officers, such as senior doctors, to grant such requests from family members.

He said future applications should be acted upon more efficiently so relatives would not have to attend a court hearing.

The only restriction was if a person died in suspicious circumstances, in which case it would need to be referred to the state coroner for approval, Justice Edelman said.

"Due to the urgency of this application, the respondent to this application, the Minister for Health, did not have the opportunity to appear or make submissions," he said.

"The minister will have a copy of these reasons and will have the opportunity to be represented in any future application in relation to implantation of the removed spermatozoa."

* Readers seeking support and information about suicide prevention can contact Lifeline on 13 11 14.