The men were caught in Braamfontein when traffic officers stopped a 16-seater minibus taxi they were travelling in, said spokesman Mayihlome Tshwete.
Three of the 24 were believed to be minors.
"The driver of the vehicle is in custody, as charges are being finalised."
Tshwete said the department would investigate whether the men were victims of human trafficking.
"It is the likelihood that they were victims of human trafficking who came to South Africa via Zimbabwe.
"They may be moved to a place of safety as investigations unfold."