He argued with the victim about matters she had been posting about on Facebook, and wanted her to hand over her phone so he could smash it with the hammer.
She refused, and Elliott continued to make threats and demands for her to hand over the phone.
"As a result, the victim, who was 36 weeks pregnant at the time with your child, started having early contractions," Judge Edwards told him in court.
The victim was taken to hospital and kept for observation for two nights.
She has since been diagnosed with depression and anxiety, is on medication, and has had to pay $1500 in taking out a protection order against Elliott.
Judge Edwards said Elliott had no previous violent offences in his "limited" criminal history.
"You were ill-equipped to manage the relationship. There's a need for you to have counselling and assistance for that," she said.
He pleaded guilty to assault with a blunt instrument, two counts of male assaults female, and a breach of protection order.
Judge Edwards sentenced him to six months' community detention, 12 months' supervision and 250 hours of community work.
She also ordered him to pay reparation of $1500, and $1000 emotional harm reparation.