It follows outrage over several recent rape incidents including the gang-rape and murder of a 14-year-old girl.
President Joko Widodo said the regulation was "intended to overcome the crisis caused by sexual violence against children".
Previously, the maximum sentence for rape, of either an adult or a child, was 14 years in jail.
People jailed for sexual offences against children may also now be made to wear electronic monitoring devices after their release.
The case of Yuyun, the murdered schoolgirl in
widespread public anger.
That grew as news of other brutal attacks came to light, including local media reports of the gang-rape and murder of an 18-year-old factory worker in Banten province.
Introduced by emergency presidential decree, the new rules are in effect immediately but could be overturned by parliament at a later date.
"An extraordinary crime deserves an exceptional response", Mr Widodo said.