Thank you for your query on healthcare magic.
It is looking like a nonedible thing which is not get digested in his gut.
Most of the children with delayed development have the habit of putting non edible things into mouth which is called pica
Nothing to worry as it came out.
But be vigilant in future and supervised in monitoring child's activities to prevent such types of incidents.
Drugs usually doesn't pass in stools as they get absorbed into gut easily.
Hope I have answered your query.