Manpower social security is regulated by the Undang-Undang nomor 3 tahun 1992 tentang Jaminan Sosial tenaga Kerja and when it comes specifically to foreign workers one should also consider the Keputusan Menteri nomor 67 tahun 2004 tentang Pelaksanaan Jamsostek bagi Tenaga Kerja Asing. Google should lead you to the two references.
Under Indonesian Law,every employee has a right to have manpower social security (Source: Pasal 3 (2) UU 3/1992: "Setiap tenaga kerja berhak atas jaminan social tenaga kerja") called jamsostek in Bahasa Indonesia and the jamsostek program is obligatory for every company for the benefit of employees doing work in a working relation pursuant to the stipulation of the law. (source: Pasal 4 UU 3/1992, " Program jaminan social tenaga kerja sebagaimana dimaksud dalam Pasal 3 wajib dilakukan oleh setiap perusahaan bagi tenaga kerja yang melakukan pekerjaan di dalam hubungan kerja sesuai dengan ketentuan Undang-undang ini."). Employers who employ foreign workers in Indonesia are required to include foreign workers concerned in their Jamsostek Program. (Source: Pasal 2 Kepmen 67/2004, "Pengusaha yang mempekerjakan tenaga kerja asing di Indonesia wajib mengikutsertakan tenaga kerja asing yang bersangkutan dalam Program Jaminan Sosial Tenaga Kerja.")
As per the Law, the scope of the Jamsostek program should cover occupational/working accident security, death security, health care security and old age security (Jaminan Kecelakaan Kerja, Jaminan Kematian, Jaminan Hari Tua, Jaminan Pemeliharaan Kesehatan) and is destined for employees but also for their family.
Note that both the employer and the employee are obliged to participate in the program, which then exclude that a foreign worker substract himself of the program and ask an equivalent compensation to the cotisation paid. (Source: Pasal 17, UU 3/1992 "Pengusaha dan tenaga kerja wajib ikut serta dalam program jaminan sosial tenaga kerja."). This is based on the principle of solidarity. Every employers and workers participate and only few benefit... but at least the weakest workers have peace of mind.
However an employee should contribute only to the Jaminan Hari Tua, while the employer is responsable for contributions to the others. The contribution should be deducted by the employer from the employee's wages and paid to the Coordination Board on behalf of him/her.
Hope it has clarified it.