Steven Modeste, 37, James Irvine, 54, and Anthony Kimber, 43, attacked Jacqui Young in Kelso in October last year.
A court heard how the trio went to the Original Factory Shop in the town's Bowmont Street wearing masks.
Modeste was jailed for eight years, Irvine for nine and a half years and Kimber for nine years.
A jury at the High Court in Edinburgh had found them guilty of armed robbery and illegally possessing a stun gun.
They were also convicted of attempting to pervert the course of justice.
The men used the stun gun on Ms Young, who was 14 weeks pregnant, and her co-worker Alexandra McMurray.
Ms Young told the court that she kicked one of the men in the groin after she had been attacked.
But they then dragged her across the shop floor and into the office where the shop's safe was kept.
Prosecutors believe the robbers got away with Â£7,300.
Afterwards, Ms Young was taken to hospital for an emergency scan to check her baby had not been hurt.
The court heard that the child had been born unharmed in April this year.
Following conviction it emerged that all three men, whose addresses were given as being prisoners at HMP Edinburgh, had previous convictions for robbery.
Judge Lady Carmichael said the sentences were given on the basis of their criminal records, with Irvine having the worst record for previous offending.
She told the three men: "All three of you have been convicted of serious offences - the most serious one was the robbery in charge two.
"It involved not just the threat of violence. What marks it out is the actual use of a stun gun on two women.
"This assault was particularly distressing as it led to concerns for her unborn child."
Three men who used a stun gun on a pregnant shop worker and her colleague in a store raid have been jailed.