He wasn't forcing her to give up the baby. He was just telling her that the church membership had been helping support her, she betrayed that support by getting pregnant out of wedlock. If she want's to keep the baby, don't expect any more support from the church.
In other words, you can have as many babies as you want, but should not expect others to pay for your choices.
Cut off the church welfare because of her choices? Ok.
Ex-communicate or give up the baby and retain membership? Not ok.