I think screen for drugs is being done with increasing frequency with employers. But like Frances was indicating, some drugs may show up as something other than what you're technically taking. If you do what Frances has suggested, that should help avoid problems. Not all urine screen tests are the same; some are more detailed, and thus more expensive, so employers may use differing tests that may misidentify a drug, but if you've been up front you shouldn't have a problem.
I'm not a lawyer but it's my general understanding that once a job offer has been made, unless a disability (and what's causing your chronic pain may qualify as a disability) can be shown to interfere with your ability to perform the job even with reasonable accomodation, they can't deny you the job. If the side effects of the meds, for example, interfere with, for example, the ability to safely use a piece of equipment, then that might matter. You may also have to show whether these medications are going to be brought into your workplace, and that they'll be kept safe. Kind of depends on the type of job you're taking.
Non-profits tend to be a lot more understanding. And your employer may not even need to know what you're taking. Just the people who are running the test. I'm not sure how much info. the employer actually gets, because you do have some privacy rights. So don't feel you have to tell your employer at this point. Just explain to those taking the test.
The one thing you don't want to do is lie, as that will get you fired immediately. And I know you're not planning to do that!