You can translate this in an active form. AT: "God has written on their hearts what the law requires them to do" or "God has shown them what the law requires" (See: [[rc://en/ta/man/translate/figs-activepassive]])
"Hearts" is a metonym for the entire person. AT: "what God requires them to do has clearly been shown to them, in their minds, soul and will" (See: [[rc://en/ta/man/translate/figs-metonomy]]).
Here "bears witness" refers to the knowledge they gain from the law that God has written in their hearts. AT: "tells them if they are disobeying or obeying God's law" (See: [[rc://en/ta/man/translate/figs-idiom]])