Attorney General Tarek William Saab said his office decided to open the probe after some of the migrants informed Venezuelan authorities of the alleged mistreatment. The investigation includes El Salvador's Justice Minister Gustavo Villatoro and the head of the prison system, Osiris Luna.
More than 250 migrants were held since March in a mega-prison known as the Terrorism Confinement Center, or CECOT, which was built to hold alleged gang members in Bukele's war on the country's gangs.
They were released on Friday by El Salvador in exchange for 10 U.S. nationals jailed in Venezuela, and as part of a three-country arrangement.
Bukele's office didn't reply immediately to a request for comment.