A spokesman for the ministry said the prisoners released were non-combatant Taliban belonging to the Mehsud tribe.
The ministry did not release their names. It said three of them had been released on March 21, five on March 25 and 11 on March 28.
They were arrested on suspicion or on the basis of intelligence reports.
The month-long ceasefire announced by the Taliban had ended on March 31.
During the first-ever direct talks with government negotiators on March 26, the Taliban had agreed the ceasefire will remain in place throughout the dialogue process.
The peace talks were held to find a solution to the deadly cycle of violence that has claimed over 40,000 lives.