Prison Act Article 140

Where an inmate is assessed and evaluated to be at risk of recidivism in accordance with Article 91-1 of the Criminal Code or Article 22-1 of the Sexual Assault Crime Prevention Act and compulsory treatment is necessary, the prison shall deliver the assessment and evaluation report for compulsory treatment of the inmate to a prosecutor of the prosecutors office four months before the completion of the sentence. The prosecutor shall apply to the court for a decision to implement post-release compulsory treatment two months before the completion of the sentence.The compulsory treatment in the preceding paragraph shall be conducted at a suitable medical institution outside the prison.Where an inmate’s actual sentence of imprisonment is less than six months and an evaluation cannot be performed, the prison shall submit relevant information and notify the competent authority of the municipality or county (city) government at the location of the inmate's household registration. The compulsory treatment shall be processed in accordance with Article 20 of the Sexual Assault Crime Prevention Act.
中文原文 監獄行刑法第140條
受刑人依刑法第九十一條之一或性侵害犯罪防治法第二十二條之一規定,經鑑定、評估,認有再犯之危險,而有施以強制治療之必要者,監獄應於刑期屆滿前四月,將受刑人應接受強制治療之鑑定、評估報告等相關資料,送請該管檢察署檢察官,檢察官至遲應於受刑人刑期屆滿前二月,向法院聲請出監後強制治療之宣告。
前項強制治療宣告之執行,應於監獄以外之適當醫療機構為之。
第一項受刑人實際入監執行之刑期不足六月,無法進行評估者,監獄應檢具相關資料通知其戶籍所在地之直轄市、縣(市)主管機關,於受刑人出監後依性侵害犯罪防治法第二十條規定辦理。

English translation for reference only; the Chinese text prevails. Not legal advice.