Rabbi Ovadyah Yosef (a”h) addresses this question in his sefer, “Chazon Ovadyah”. He states rules that it is indeed permissible to wear such a garment on Shabat, even if one knows for certain that static electricity will be produced. He explains that to begin with, producing a spark – as opposed to an actual flame, is in general forbidden only on the level of “Mi’de’rabanan,” a Rabbinic enactment, as opposed to Torah law.
The Gemara establishes that “Nitzotzot ein bahem mamash – sparks are not significant and thus do not violate the Torah prohibition of Mav’ir. Igniting a spark is forbidden only on the level of Rabinic enactment. This point was also made by the Ben Ish Chai (a”h), in responding to a question posed to him by a man who had struck a match on Shabat and produced a spark. The man wanted to know how he should go about repenting for this violation, and in his response the Ben Ish Chai noted that the man had not committed a Torah violation, but rather a Rabinic enactment.
Rabbi Ovadyah proceeds to explain that when it comes to a prohibition enacted by the Sages, we may be lenient in situations of “Pesik Resheh – where one has no intention to perform the forbidden act.” There is a famous ruling of the Aruch which permits performing an action on Shabat even though it will inevitably result in a Shabat violation, as long as one has no interest in that result.
An example of this would be candles placed near a door on Shabat, such that the flames will flicker every time the door opens because of the wind. The Aruch would permit opening the door, even though this causes the flame to rise and then descend (which violates the prohibition of Mav’ir), since the person has no interest in causing this effect.
The Shulchan Aruch rules stringently in both cases and maintains that one may not perform an act that will invariably result in a Shabat violation. However, Ha’Rav Ovadyah asserts that the Shulchan Aruch would likely rule leniently if the violation at stake is forbidden only Mi’derabbanan, a Rabinic Enactment. Although the Shulchan Aruch does not accept the Aruch’s position permitting actions that result in Torah violations, we can assume that he would accept this position with regard to prohibitions enacted by the Sages.
Therefore, when it comes to producing static electricity, which entails a Rabinic violation, it is permissible when this result is unintended. This is certainly the case when one wears clothing which creates static electricity, as he has no intention whatsoever to create electricity. It is therefore permissible to wear such clothing on Shabat.