On Tuesday, Indonesian lawmakers overwhelmingly passed a long-awaited new penal code that includes the criminalisation of extramarital sexual relations and cohabitation. A seemingly co-ordinated effort by a number of non-Muslim and secular news outlets and rights groups has decried the move, but we welcome the decision as one that revives a timeless and much-needed Islamic ruling. 
Indeed, for a country with a Muslim majority that covers over 86 per cent of the roughly 275 million-strong population, the enactment of these specific pieces of legislation can only bring about benefit and prosperity to the nation. 
Allah states in the Qur’ān,
“Do not go near adultery. It is truly a shameful deed and an evil way.” 
In addition, the Messenger (ﷺ) is reported to have said,
“O young men, whoever among you can afford it, let him get married, for it is more effective in lowering the gaze and guarding chastity; and whoever cannot, then he should fast, for it will be a restraint for him.” 
During yesterday’s parliamentary business, legislators from all of the major political parties came together to ban extramarital sex and impose a punishment of up to one year in prison or a fine.
Prior to the change in law, premarital sex was not officially illegal, while adultery was a crime. However, now, both of these actions are deemed illegal under Indonesian law.
In addition, the act of cohabitation is now punishable by up to six months in prison or a fine, but the enforcement of the law will largely be dependent on parents, children, or a spouse, reporting the crime to police. The full implementation of the new code is likely to take up to three years, in large part due to the enormity of the changes.
Criminalising that which is already criminal
Regrettably, some in Indonesia and around the world have condemned the new legislation. Among the people who have wrongly criticised the law are Amnesty International’s Indonesia director, Usman Hamid. In his words, he told the AFP news agency, “We are going backward”. 
“…repressive laws should have been abolished but the bill shows that the arguments of scholars abroad are true, that our democracy is indisputably in decline.” 
Dr. Salman Butt, the Chief Editor at Islam21c, said in regards to comments such as the above,
“If those like in Amnesty International describe a sovereign, elected parliament democratically voting for such a law as ‘democracy … in decline’, one can only surmise that they have a condition for ‘democracy’: that which does not offend white Anglo-American norms, tastes, and sensibilities.”
Another individual who was quoted by the BBC as being in disagreement with the change in legislation said they believed that extramarital relations are “not a crime”. 
“With the new law, both of us can go to jail if one of the family decides to make a police report. What if there’s one family member who has a problem with me and decides to send me to jail?
“I think living together or having sex outside of marriage is not a crime. In my religion, it’s considered a sin. But I don’t think the criminal code should be based on a certain religion.” 
Others in the international media and within Indonesia have claimed that the criminalisation of sex outside marriage and cohabitation risks damaging the country’s bustling tourism trade. Moreover, some have suggested that the laws will dampen investment opportunities and turn away potential financiers. 
It is odd to see pockets of people within Indonesia and outside the country worrying about the potential impact on investment, foreign tourists, and other areas of the economy. In Islam, there is never a detrimental effect when one leaves behind a harmful thing.
In a ḥādīth reported by Abu Qatāda (radiy Allāhu ‘anhu), the Prophet (ﷺ) said:
“Verily, you will never leave anything for the sake of Allah Almighty, but that Allah will replace it with something better for you.” 
Other familiar pieces of legislation
Among the other aspects of criminal law that have been modified or retained, the death penalty is preserved in the new code. However, there is now a 10-year probationary period in which convicts, if well behaved, may see their death sentence reduced to life imprisonment or 20 years.
Abortion remains banned, except in exceptional circumstances, and there is now a restored law that prohibits insults against the country’s President, Vice President, state organs, as well as Indonesia’s national ideology or pancasila (five principles).
Also in the new penal code are six blasphemy laws, including apostasy. However, contrary to what may be believed, to renounce the religion is not specifically directed at Muslims and Islam. Based on Indonesia’s official recognition of six religions (Buddhism, Confucianism, Islam, Hinduism, and Catholic and Protestant Christianity), it is now illegal for anyone to encourage the renouncement of any of the aforementioned faiths. The new criminal code marks the first time since independence from the Netherlands and Japan after WWII, that it is illegal to persuade someone to become a non-believer.
Also read & watch
 al-Qur’ān | 17:32
 Sunan an-Nasa’i | 3209
 Musnad Aḥmad | 23,074