It was narrated that Ibn 'Abbas said: "The Messenger of Allah forbade selling something from the spoils of war prior to its distribution, having intercourse with a pregnant woman until she gives birth, and (eating) the flesh of any predator that has fangs. -- Sunan an-Nasa'i 4645 [grade: sahih] (sunnah.com)
Does this hadith imply it's haram to have sex when one's wife during pregnancy?
IslamWeb interpreted it as meaning either a captive or a pregnant divorced woman:
... all the above Hadith do not apply to having sex with one's wife; all these and similar Hadith relate to a pregnant woman who is divorced or a captive.
A comparable interpretation was given by Darul Iftaa (here; see also here) when the man married a woman who was pregnant as the result of adultery:
The only difference is if the man is the father of the unborn child he would be able to have intercourse with her whereas in the situation where the man is not the father of the child, he would not be allowed to have intercourse with her until she gives birth to the child
Like any library, Islam Stack Exchange offers great information, but does not offer personalized advice or legal verdicts, and does not take the place of seeking such advice from your Mufti, Imam, or other trustworthy Counselor.