The gun may go back to the rightful owner if it was taken without their knowledge. Make sure whoever tries to claim it had it properly stored according to your states storage laws, otherwise if it wasn't the owner could face penalites.
Sadly suicide is a crime and the gun was used in the crime. However, you may still be able to get the gun back if it is yours and you can prove it is yours. Generally, evidence which belongs to someone other than the perpetrator of a crime is kept only for investigation and prosecution. It can be released after those activities are completed. (Think about a stolen vehicle used in a robbery - it gets returned to the rightful owner as soon as authorities can do so.)
Contact the local police department to see what they will require to return the gun.
Note - if you provided the gun to the person to commit suicide, you may be an accomplice to a crime . . . I am sorry for your loss.
Suicide is not a crime in Texas. It is a crime to assist in a suicide or suicide attempt.
Texas Penal Code §22.08 provides that "a person commits an offense if, with the intent to promote or assist the commission of suicide by another, he aids or attempts to aid the other to commit or attempt to commit suicide."
You should contact the detective who handled the case and inquire about the return of the weapon. Depending on departmental policy, you may be able to recover the weapon informally or you may have to have a property hearing in City or Justice Court. The police will retain the weapon as evidence so long as there is an open investigation.
Mr. Leonard is not correct - suicide is a crime because one causes the death of an individual. It does not require that one cause the death of another individual or an individual besides himself. I have had this conversation with homicide detectives and prosecutors in the past when a police officer committed suicide and the investigating officers refused to release the report because the case was a pending case (which would always pend because it was not closed by charges, etc.)
Regardless, I stick with my original answer.