Praise be to Allah.
A number of scholars have stated that it is makrooh
(disliked) to mention Allah verbally when having intercourse.
An-Nawawi (may Allah have mercy on him) said: it should be
noted that dhikr (remembering Allah) is encouraged in all situations, except
in situations referred to in sharee‘ah (Islamic law), some of which we will
mention here. For example: it is makrooh to remember Allah (verbally) when
sitting to relieve oneself, when having intercourse, during the khutbah
(Friday sermon) for the one who can hear the voice of the khateeb (orator),
when standing during the prayer, at which time one should be focusing on the
recitation, and when one is drowsy. End quote from al-Adhkar.
Ibn ‘Allan said in his Sharh (commentary): what is meant by
dhikr here is remembering Allah verbally, because this is what one is
required to refrain from in the cases listed. As for remembering Him in
one’s heart, that is required even in these cases. Our companions said: if
the one who is relieving himself or engaged in intercourse sneezes, he
should praise Allah in his heart. In al-Haraz ath-Thameen it says that dhikr
in one’s heart at the time of relieving oneself or engaging in intercourse
is not makrooh, according to scholarly consensus. As for remembering Allah
verbally at those times, that is not something that is prescribed for us and
the Prophet (blessings and peace of Allah be upon him) did not recommend it
to us and it was not narrated from any of the sahabah (companions). Rather
at such times it is sufficient to be modest and remember that Allah is
always watching, and remember the blessing that Allah, may He be exalted,
has bestowed by making it easy to expel this harmful matter that, if it was
not expelled, might kill one. This is one of the greatest forms of dhikr
even if it is not spoken verbally.
End quote from al-Futoohat ar-Rabbaniyyah.
From this you may know that you can remember Allah in your
heart, but it is makrooh to utter the dhikr out loud.
See: al-Mawsoo‘ah al-Fiqhiyyah.
See also the answer to questions no.
And Allah knows best.