Al-Ma'mun
He had one wife who he tried to divorce. However, his wife got a powerful judge who refused to allow the divorce. He had no children and no heirs with this wife. Instead, he chose another woman to provide an heir.