First of all, from a strictly grammatical perspective, the use of this numeral is not particularly strange. While it also might not be particularly common, it does occur like this in other contexts as well. So, for example, שנים חדשים in 1 Kings 5:28, שנים כרֻבים in Exodus 25:18 and שתים נשים in 1 Kgs 3:16.
If you want to see some grammars that mention this as a normal function of the numeral, see Waltke and O'Connor (An Introduction to Biblical Hebrew Syntax, §15.2.1j) and Joüon and Muraoka (A Grammar of Biblical Hebrew, §142c). Neither of them give a particular reason for it either.
The number of mefarshim who remark upon it appears to be fairly small, and my suspicion is that while it's an unusual form it's not unusual enough to have warranted comment. That said, however, there are some people who do draw attention to it - particularly in relation to the fact that שני עדים appears in Deuteronomy 19:15.
So, the Baal haTurim for example (on 19:15) explains the difference between the two attestations as relating to the fact that the first verse (17:6) spoke of capital cases, while the second speaks of financial tribunals. In the former instance, intimidation of the witnesses is more important, and so the Torah uses a longer word in order to indicate a lengthier process. In his words: למעלה כתיב על פי שנים עדים דהכא איירי בממון ואין מאיימין עליהם כל כך כמו בנפשות.
The Netziv also remarks upon the use of שנים in 17:6, and his argument is an interesting one. Had the text said שני עדים, it would suggest that the two witnesses are somehow identical with one another. Rabbis Yehuda and Mordekhai Yaakov Kuperman, who provide glosses to the Haamak Davar (Jerusalem, 2011), give two other examples of the same phenomenon, as pointed out by the Gra:
Genesis 1:16 mentions שני המאורות הגדולים, and chazal learn out (Hullin 90b) that they were both the same size; Leviticus 16:5 mentions שני שעירי עזים, and chazal learn out (Yoma 62b) that they were identical.
The Netziv goes on to buttress this point in reference to R' Bahya ibn Paquda's interpretation of Exodus 25:18 - the injunction to make שנים כרֻבים implies that the two cherubim were both different from one another. In that case, that one was in the form of a male and the other in the form of a female. In our case, however, referring to the witnesses as שנים עדים implies that their opinions do not entirely harmonise.
The Netziv concludes by bringing a passage from the Yerushalmi (on Sanhedrin 5:2), to the effect that if the two witnesses in a capital case align too closely with one another, and based on the fact that two different people cannot possibly have exactly the same story without prior arrangement, then they need to be investigated.
As such, the Netziv finds a basis for the opinion of the Yerushalmi in the verse itself: we don't want the two witnesses to be exactly the same, but to be fundamentally different from each other. That they are described subsequently as שני עדים in 19:15 is because of the fact it is through their disagreement that they become one. In his words: ובזה הניגוד נעשים אחת.