The nakedness of your son’s daughter… (Leviticus 18:10)
One may not have sexual relations with a son’s daughter. It makes no difference whether the son or the granddaughter is born out of wedlock or the product of a forbidden relationship, blood is blood and the relationship would be considered incest. A great-granddaughter on the son’s side is forbidden rabbinically.
The reason underlying this prohibition is identical to what we have said in previous cases of incest, regarding stringent preventive measures in the case of those whom we see frequently and are overly familiar.
This mitzvah applies in all times and places. In the Talmud, it is discussed in the tractates of Yevamos (22a; 97a) and Sanhedrin (75a). It is codified in the Shulchan Aruch in Even Ha’Ezer 15. It is #334 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #119 of the 194 negative mitzvos that can be fulfilled today as listed in the Chofetz Chaim’s Sefer HaMitzvos HaKatzar.