The incident happened around 9:30 a.m. Monday, when officers got information about drug activity in a car on Maple Lane in Medford.
An officer investigated and discovered drugs and a weapon in the car, along with a 3-year-old girl.
Zhurnay Hardy, 30, of Medford, and Christina Shepherd, 34, of East Patchogue, were arrested. Shepherd's daughter was unharmed.
Each was charged with possession of a controlled substance, endangering the welfare of a child, criminal possession of drug paraphernalia and criminal possession of a weapon, among other charges.
Child Protective Services assisted and the child was released to a family member.