Anthony Merino faces up to seven years in prison after pleading guilty to desecration of human remains.
But under a plea deal, the 25-year-old could be placed on probation after nearly a year behind bars.
Authorities said a security guard last year saw Merino engaging in sexual activity with the body in the Holy Name Hospital morgue.
Merino has agreed to undergo a psychological evaluation and will be prohibited from working at a hospital morgue.