it can often (correctly) be used synonymously; but there are of course often cases where that is not the case, and yet even then it seems to me difficult to come up with a consistent rule that applies. You could say some rule/s apply most of the time but not always.
'refrain' is most commonly and correctly used when someone is directing other people not to do something eg commonly smoking: by contrast, 'abstain' is more commonly about one's own decision, eg abstaining from alcohol. And i think another writer has made a point about the periodicity/frequency of what is being refrained/abstained from: namely, 'refrain' is generally (always?) for short fixed and/or one-off instance; whereas 'abstain' generally indicates a longer-term/on-going personal decision.
And there are those cases of incorrect usage ie where one word has been used when the other would be (more) correct: this incorrect usage then leading to ever wider incorrect usage.
[a la my personal bete noir 'angst'] (hmm. diacritics don't see to work here)