There would be no criminal liability if the pill were legal (which it evidentally was, since it was a prescription pill) and also there was no intention of harming the child.  It is possible that you could be sued in civil court of the cost of the child's medical care or for his/her injuries resulting from swallowing the pill (if any), on the grounds that you were negligent in dropping the pill--though if you warned the mother, that act may well be enough to provide a viable defense (show you were not negligent, or unreasonably careless).