Officials say pupils from Pulamadibogo Primary School, near Pretoria, bought the sweet treats from a nearby street vendor.
They soon experienced nausea, stomach pain and vomiting – with three girls still in hospital.
Two people have been arrested and face charges of attempted murder, reports the BBC.
The suspects, aged 21 and 19, will appear before Soshanguve Magistrate’s Court on Friday, police said.
The Gauteng provincial education department said teachers had called an ambulance after noticing “strange behaviour” from children in class.
Police, who are conducting a toxicology report to confirm if cannabis was used, say more than 90 pupils received the muffins and suffered “serious pains”.
They were all sent to nearby medical facilities, and “about 87” have been discharged, the education department said in a statement.
“Only three girl learners remain in hospital, and they are still receiving the necessary medical attention to return to health,” it said.
Earlier this year, the Democratic Alliance (DA) party called for better vetting processes for street vendors, after eight children were admitted to hospital having eaten so-called ‘space cookies’ outside their school.
The party’s spokesperson Khume Ramulifho also said he would pressure the provincial government to improve safety measures at school.