I don't like C or D,
Student or Learner
Can one write
a. She was given a pepper spray to use only for self-defense.
b. She was given a pepper spray to be used only for self-defense.
c. She was given a pepper spray, to use only for self-defense.
d. She was given a pepper spray, to be used only for self-defense.
In (c) we focus on two things: She was given a pepper spray AND she was to use it only for self-defense. I don't think (d) works...
Also, I generally consider 'pepper spray' non-count, so "a pepper spray" sounds unnatural to me.
It's similar (grammatically and chemically) to mace, which is always non-count. (Unless of course you're referring to the medieval hand weapon, but then I don't think many people carry them nowadays...)
Also, given the nature of the substance, to specify 'to be used only' seems redundant. Unlike some other self-defense options, say a gun or even a taser, which could be used for recreational activities or practice, you're only going to use pepper spray for actual self defense - it's a one-time usage for the most part.
I'd prefer something like "She was given pepper spray for self defense".
Wear short sleeves! Support your right to bare arms!
I'd accept it with or without the indefinite article although with the article, I'd probably say "... a canister/container of pepper spray".
Remember - if you don't use correct capitalisation, punctuation and spacing, anything you write will be incorrect.