When Matt Cronin worked in customer service at Nurx, a San Francisco start-up that sells prescription drugs online, one of his jobs was to manage the office’s inventory of birth control pills.

The pills were kept in the pockets of a shoe organizer hanging inside a closet, Mr. Cronin said. They had been shipped to Nurx customers from its partner pharmacies, but ended up at the office when they bounced back in the mail. His supervisors regularly assigned him to mail those same medications to different Nurx customers who had not received their pills, he said.

The practice was unusual. For safety reasons, federal and state laws generally require prescription medications to be dispensed through a licensed pharmacy and prohibit pharmacies from shipping returned medicines.