Exodus 1:15-22 (ESV)
Then the king of Egypt said to the Hebrew midwives, one of whom was named Shiphrah and the other Puah, “When you serve as midwife to the Hebrew women and see them on the birthstool, if it is a son, you shall kill him, but if it is a daughter, she shall live.” But the midwives feared God and did not do as the king of Egypt commanded them, but let the male children live. So the king of Egypt called the midwives and said to them, “Why have you done this, and let the male children live?” The midwives said to Pharaoh, “Because the Hebrew women are not like the Egyptian women, for they are vigorous and give birth before the midwife comes to them.” So God dealt well with the midwives. And the people multiplied and grew very strong. And because the midwives feared God, he gave them families. Then Pharaoh commanded all his people, “Every son that is born to the Hebrews you shall cast into the Nile, but you shall let every daughter live.”
What an amazing story of trust in God. They actually defied the orders of Pharaoh to obey God. This falls into the same category where Peter and the Apostles found themselves when told by the government authority to stop presenting the gospel:
Acts 5:29 (ESV)
But Peter and the apostles answered, “We must obey God rather than men.
Disobeying government to obey God has a very thin line. Notice during the persecution of Christians in Rome what Paul told the church in Rome:
Romans 13:1-3 (ESV)
Let every person be subject to the governing authorities. For there is no authority except from God, and those that exist have been instituted by God. Therefore whoever resists the authorities resists what God has appointed, and those who resist will incur judgment. For rulers are not a terror to good conduct, but to bad. Would you have no fear of the one who is in authority? Then do what is good, and you will receive his approval, ...
The midwives in Egypt were disobeying the authority of the day to save lives. Peter and the apostle were doing so to speak the gospel message. Disobeying God’s establish earthly authority because you don’t like it is not in God’s word. These midwives were rewarded by God for saving lives and, especially saving the lives of God’s chosen people. They obeyed God rather than man, not for personal gain, but because it was the moral and godly thing to do. God rewards these types of acts of faith. They put their lives on the line to obey God.