Immediately after the April 1978 coup d'état in which the People's Democratic Party came to power, Keshtmand became the minister of planning in the newly formed Democratic Republic of Afghanistan. He lost that post in August 1978 when he was arrested for an alleged plot against President Nur Mohammad Taraki, a member of the rival Khalq faction of the party. The PDPA Politburo ordered the arrest of Keshtmand and Public Works Minister Muhammad Rafi'i for their part in the possible anti-regime conspiracy. He and the other inmates went through severe torture and long imprisonment. He remained in prison and was sentenced to death, but this decision was revoked and he was resentenced to 15 years in prison. On December 1979, the Soviet Union invaded Afghanistan, bringing Babrak Karmal and the Parcham faction to power. Keshtmand was released from jail, and was once again joined the Politburo. Friction among the People's Party members rose in 1980 when Karmal removed Assadullah Sarwari from his position as First Deputy Chairman of the Council of Ministers and replaced him with Sultan Ali Keshtmand. Keshtmand, a Parchami, soon became one of the most important leaders of the regime. In June 1981, Karmal retained his other offices, but resigned as Council of Ministers chairman and was succeeded by Keshtmand. A 21-member Supreme Defense Council headed by Mohammad Najibullah effectively assumed power. The rise in the deficit greatly concerned the government, and as Council of Ministers chairman Keshtmand noted in April 1983, the tax collections were inadequate in view of the increased state spending. The security situation in the country, however, prevented the government from improving its tax collections. In September, 1987, the Kabul government sponsored a large convocation of Hazaras from various parts of the country and offered them autonomy. In his speech to the group, Keshtmand said that the government was going to set up several new provinces in the Hazarajat that would be administered by the local inhabitants.
He served as Chairman of the Council of Ministers from 1981 to 1988 and 1989 to 1990, and as one of the vice presidents from May 1990 until April 1991, when he was dismissed shortly before the fall of the government. A mujaheddin radio station reports intra-Parcham clashes in Kabul between supporters of Najibullah and Keshtmand, Chairman of the Executive Committee of the Council of Ministers. Non-PDPA member Mohammad Hassan Sharq was selected by President Najibullah to be the new Council of Ministers chairman, replacing Keshtmand. This move was made in order to free spaces in the new government for nonparty candidates. He then left Afghanistan, first moving to Russia and then to England. There he became an outspoken defender of the rights of Hazaras and other minorities, claiming that the Pashtun majority in Afghanistan had had too much power in all of Afghanistan's regimes, past and present. After the communist Saur Revolution, which toppled Daud Khan's first Afghan Republic, he reportedly said, "Brothers, today the five long centuries of Pashtun political domination has come to an end."