Because of Jesus' birth there was a new star. Because of the new star men from the east came to worship Him. Because of these men who brought gifts and worship, Herod found out about Jesus. And because of this many many people saw their tiny sons killed.
And when we do what we are called to do, evil may retaliate and others may get hurt.
There was nothing Joseph or the men from the east could have done to stop Herod. All they could do was obey God.
And that was enough.
God saw the children murdered. He felt the pain of the mothers and fathers who saw their sons killed. It was evil. But God was there. God is a good God. And He will restore and heal and bring great goodness out of evil that is done to us if we let Him.
We cannot second guess God and be worried how our obedience will affect those around us. We must obey and let God take care of the details. He will. And He'll do a whole lot better job than we ever could.