Farmajo said the release of the prisoners with petty crimes follows a report submitted to him by the country’s attorney general on the conditions of the prisoners in the wake of COVID-19.
The president also directed prison authorities and the Ministry of Health to take adequate measures to prevent health risks for the remaining inmates.
Farmajo said he invoked Article 90 of the Provisional Constitution, which grants him powers to pardon prisoners who are not serving sentences for serious crimes.
The Horn of Africa nation has so far confirmed five coronavirus cases involving three Somali nationals and two foreigners.
Somalia has banned both domestic and international flights and public gatherings, among other measures, to contain the spread of the pandemic.