Both versions are correct, but I'd say "margin of error" is used much more frequently. I would not view the two as interchangeable, though there are probably some contexts in which you could use either one.
A "margin of error" is a fixed expression, and the three words form a single idea. It is an acceptable/allowable deviation from the norm. In statisitics, this expression is a measurement of accuracy.
When people use "margin for error", the word "for" indicates purpose. The word "margin" could usually be replaced with another word, such as "room" or "space", for example. So, when people say "margin for error", the words are generally being used more individually. If I said "He left us no margin for error" that would mean "He did not leave us any space/room/leeway to make any mistakes".