He said Indonesia respected human rights but there would be "no compromise" when it came to punishing such sexual crimes.
Indonesia passed controversial laws earlier this month authorising chemical castration for paedophiles.
The laws were subject to fierce debate in parliament.
"Our constitution respects human rights, but when it comes to sexual crimes there is no compromise," President Widodo said.
"We are strong and we will be very firm. We will hand out the maximum penalty for sexual crimes."
He added: "In my opinion… chemical castration, if we enforce it consistently, will reduce sex crimes and wipe them out over time."
In a wide-ranging interview with the BBC's Yalda Hakim, President Widodo - also known as Jokowi - discussed topics including the South China Sea, corruption, a recent tax amnesty and the government's stance on homosexuality.
Earlier this month, an advert for a new youth ambassador position stipulated that members of the lesbian, gay, bisexual and transgender (LGBT) community need not apply.
The government advert said the post was only open to applicants not involved in "sexually deviant behaviour".
President Widodo said there was no discrimination against minorities, but he added: "We are the world's largest Muslim nation and we have religious norms. You have to remember that and know that. We have social norms."
On the subject of the ongoing maritime rights dispute in the South China Sea, Mr Widodo defended Indonesia's stepped-up military presence around the Natuna Islands.
He said the Indonesian military was acting to stop illegal fishing in the area.
"This is our natural resources, this is Indonesian wealth. So from now on illegal fishing vessels cannot play around with us," he said.
"The second thing is Natuna is our territory. Natuna is in Indonesia. So if we want to do military operations, war games, then it's our right. In terms of sovereignty I will never compromise."
'Harsh and strict'
He also said the government was cracking down on corruption.
"Nine ministers, 19 governors, 300 more local leaders [and] 100 parliamentarians are in jail because of corruption," he said.
"We are harsh and strict on corruption. We will be consistent in our harshness to improve the situation."
In September, thousands of Indonesian workers protested in Jakarta against a government tax amnesty scheme.
It was meant to plug a budget deficit but unions say it unfairly pardoned wealthy tax dodgers.
"It's not really about how much money we earn from it, how much money is repatriated," President Widoko said.
"The most important thing is this is the start of reforming the tax system in Indonesia.
"We want to expand the tax system, we want to improve the tax system and we want to build trust and faith among people in our tax system so that industry and businesses that pay tax they believe that there money will go to the good of the country and be used to build things."