The couple, who had been together for seven years, cannot be named for legal reasons.
Prosecutor Michael Greenhalgh told the court how the woman entered the "advanced stages of labour'' while the couple were in bed at around 11.30pm.
The defendant fell asleep but his girlfriend did not.
Greenhalgh said: "She was in bed, naked as she normally would be.
"To try and relieve the pressure and the pain of the contractions, she got onto all fours because she had been told that was a way of relieving the pain.
"She was in that position when the defendant woke up. He saw her naked on all fours and said 'I feel horny', to which she replied "are you serious?".
"The defendant then got behind her and started having sex with her."The prosecutor said the woman "made it clear'' that it was "not something she wanted or something she was consenting to'' but the defendant ignored her protests.
Greenhalgh said after the alleged assault the defendant "even asked if she wanted him to run a bath for her''.
He continued: "Shortly after this had happened, she went to hospital and the couple's son was born.''
Following the baby's birth, the alleged victim stayed with her mother because the heating at the couple's property was broken.
When she returned home she reported the alleged rape to her family and police.
Greenhalgh said initial texts between the pair after the birth were of affection and excitement because of their child but that the tone soon changed when she went back home.
He said: "The woman will note two things precipitated that change. Firstly, she was back in the bedroom where this happened, which is a stark and uncomfortable reminder to her. And, he behaved in an inappropriate way with the new baby.
"The child is crying and he wouldn't let her pick the child up and refers to it as a "spoiled little ****". It was at that point she decided she couldn't forget what has happened."
The defendant denies the pair had sex. The trial continues.