We do not see any harm for a Muslim to accept this kind of testing if the government asks him to do so. However, it should be noted that in order to prove family lineage, there are some religious requirements that are taken into account in Islamic legislation and not this kind of testing. The Prophet
sallallaahu `alayhi wa sallam ( may Allaah exalt his mention ) said: "The boy is for the owner of the bed and the stone is for the person who commits an illegal sexual intercourse (i.e. the child will not be traced back to him)." [Al-Bukhaari and Muslim] So whoever has a wife and she gives birth to a child on his bed, it is his child and is traced back to him. It is only by the husband cursing his wife that a child could be denied by him that he is not his. [The method of cursing is mentioned in Fatwa: 89532].