I presume that the question refers to "opioids", which are narcotic drugs originally produced from opium poppies. Natural opioids are drugs like opium, morphine, and heroin. There are synthetic opioids like fentanyl (and its many derivatives) and demerol. The length of time that opioids remain in the body is very dependant on how well the person's liver can metabolise the drug. In general, infants and the elderly, and those with liver disease, cannot metabolise drugs as quickly as normal, healthy young adults. Also, the natural opioids tend to take longer to clear from the body than the synthetics. When discussing the clearance of drugs, we often refer to the "half-life" that is, how long it takes to remove 50% of the drug from the body. This does not mean that every molecule of the drug is gone, but that only half is still in the body and having an effect. The newer synthetic fentanyl narcotics have a half life measured in minutes or one or two hours, demerol about 3 hours, morphine 4 hours (I don't know much about the illegal drugs, and these numbers may not be entirely correct, as I'm writing from memory).
There's quite a difference between when the drug is totally gone from the body (which could be days, depending on how well the liver can clear it) and when the effect of the drug is no longer significant (which in normal, non-addict people is generally measured in hours). Those who are addicted to narcotics, or on long term treatment with them, build up a tolerance to the drug, so that a blood level that would be more than effective in a normal person, will have much less effect on an addicted person. These people would require more frequent and higher doses than normal.