This idea is called the Divine Right.
Divine Right was a popular concept in the 17th century which proposed that God has given the kings the "right" to be king, and that rebellion against the king was considered the greatest sin as you were going against God's will.