JAKARTA, Indonesia — The president of Indonesia, Joko Widodo, named a longtime political rival to his cabinet on Wednesday, appointing a once- disgraced former general accused of human rights violations to the post of defense minister.

The appointment of the new minister, Prabowo Subianto, who has twice lost presidential elections to Mr. Joko, is indicative of the president’s willingness to curtail civil liberties in order to maintain a coalition in Parliament with which he can push through an economic agenda.

Weeks after student protests that were fueled in part by a contentious criminal law rocked the capital, Jakarta, Mr. Joko also reappointed the justice minister, Yasonna Laoly, whose policies helped stir the public’s outrage.

But Mr. Prabowo is a notorious figure, and his appointment to the cabinet is both the comeback he has been attempting for decades and a sign that Mr. Joko is turning his back on civil liberties.