Reading between the lines your question really seems to have two different parts.
Does my disability justify me working from home?
Without questioning your condition and medical requirements, the bottom line here is that chronic pain has a bad reputation despite the fact that it can be a valid medical condition. The common public perception is that pain management doctors are nothing more than legalized pill pushers catering to weaklings and drug addicts.
Harsh I know, but you will have to deal with that perception. If an employer is suggesting or questioning your need to work from home they are more than likely basing their concern on that perception.
You will need to document everything with your manager and the HR department. Including a statement from your doctor(s) that you are sometimes required to take strong medication that prevents you from driving.
You also need to be responsible about this as well. If the arrangement is that you only work from home on days when you take your medication you need to make every effort to show up at the office when you don't. In other words don't abuse the situation.
How can I maximize productivity and teamwork when working from home?
Addressing the productivity and teamwork, as other answers have stated, is really a question of communication and perception.
If you're supposed to be working from 9 to 5 make sure you are. No letting the dog out, washing the dishes, or anything else that's not work related.
Stay in contact and in the loop. Answer IM's, email and phone calls in a timely manner. Remember your co-workers can't look around the corner and see that you're heads down in an issue or swamped with work. The natural reaction is to question where you're at and what you're doing.
Participate in meetings, conference calls, stand ups and so on. If a meeting is being held and your expected to be there you should know how you can connect. Phone, video conference, and so on. If the option isn't available you have every right to ask for it.