We once had a case where a girlfriend left her drugs in her boyfriend's backpack. After dropping his girlfriend off at home, our client got pulled over. He consented to a search of his car as he didn't have anything to hide.
But - then the police found drugs in his back pack. He had no idea that the drugs were there. Since he didn't have any knowledge of the drugs, and were were able to get information from the girlfriend and the pharmacy that filled the prescription we were able to get the charges against our client dropped.
Most cases like this - when people are charged with drug possession due to being in possession of drugs that aren't even theirs - don't end as well as that scenario, unfortunately.