British businessman Shrien Dewani had hormone problems and underwent testosterone replacement therapy, the Western Cape High Court heard on Monday.
"I decided to undergo this treatment despite the side-effects. Having my own family was important to me," he explained in a plea document.
Dewani has pleaded not guilty to the murder of his wife Anni in Cape Town in 2010, and other related charges.
An endocrinologist told him in 2009 that he had abnormally low levels of the hormone and may have trouble reproducing.
He was warned of the side-effects, including the risk of blood clots, sleep apnoea, breast enlargement, weight gain, and acne.
"I discussed my problem with Anni as I knew that she wanted children as well."
Earlier, it was revealed he was bisexual and had sexual interactions with both men and women.
"My sexual interactions with males were mostly physical experiences or e-mail chats with people I met online or in clubs," his lawyer Francois van Zyl said, reading out Dewani's plea explanation in court.
"My sexual interactions with females were usually during the course of a relationship which consisted of other activities and emotional attachment."
Dewani is charged with murder, kidnapping, robbery with aggravating circumstances, and conspiracy to commit these crimes. He is also charged with defeating the ends of justice.
Deputy Judge President Jeannette Traverso sat with her arms crossed and looked at the indictment in front of her. She was flanked by two assessors.
Both the families of Dewani and his slain wife were in attendance, sitting on opposite ends of courtroom two.
Dressed in a black suit, tie and white shirt, Dewani stood in the dock and looked down at prosecutor Adrian Mopp. Mopp read out the charges in a loud, clear voice.
Dewani seemed calm, cocked his head slightly to listen and made fists with his hands. At times, he frowned slightly or looked away to the side.
He met his wife Anni Hindocha on May 30, 2009 after a mutual friend gave him her contact details.
In his plea explanation, he said he was instantly physically attracted to her on their first date, loved her bubbly personality and sensed there was mutual chemistry.
"We were both ambitious and shared a common view on our future. We were both headstrong and often argued with each other," he explained.