I get back spasms myself sometimes, and when my back bothers me, I take Robaxacet. I assume that's the kind of medication you're talking about. Given that it is over the counter, so long as you take it in accordance with the instructions given on the package, then you're within your rights as a CF member. If you feel that you should bring it with you, do so, and advise your course staff when you get to the school that you have it. They may take it away from you, or they may not, but either way, you won't get in trouble if you tell them right off the bat.
I advise you to see a doctor about your problem, if you haven't already. (I'm assuming that you were candid with your recruiters about this issue, and that you were cleared to join the military and participate in basic training with no restrictions. If not, then that's a whole different can of worms that I'm not even going to get into.) When I saw my doctor about my back spasms, he gave me a list of stretches to do, that I find really help if I do them in advance of heavy lifting, etc. Maybe a doctor could give you some similarly helpful advice.
There are times to suck it up and soldier on, and there are times when that's the worst possible thing you could do. There are going to be times during your training when you'll be tired, cold, hungry, wet, or otherwise miserable, and that's just unavoidable, but if you are in actual and serious pain, then it might be time to think about taking it a bit easy.