Can you show me with any credible, moral, and compassionate justification how passages such as Numbers 31:18 and II Samuel 12:11-14 are not examples of divine-sanctioned rape?
In Numbers 31, the Lord ordered punishment on the nation of Moab. "Take vengeance on the Midianites for the children of Israel. Afterward you shall be gathered to your people" (Numbers 31:2). Moab had tried to get the prophet Balaam's help in wiping out Israel, but it failed because they forgot that God was with Israel. Seeing he could not get what he wanted, Balaam had suggested to the king of Moab that if he got Israel to sin, God would wipe out the people Himself. A large number of Israelites did die because of Balaam's suggestion and it had come a time that punishment came upon Moab for leading people into sin to get them killed.
"And they warred against the Midianites, just as the LORD commanded Moses, and they killed all the males. They killed the kings of Midian with the rest of those who were killed-Evi, Rekem, Zur, Hur, and Reba, the five kings of Midian. Balaam the son of Beor they also killed with the sword. And the children of Israel took the women of Midian captive, with their little ones, and took as spoil all their cattle, all their flocks, and all their goods. They also burned with fire all the cities where they dwelt, and all their forts. And they took all the spoil and all the booty-of man and beast. Then they brought the captives, the booty, and the spoil to Moses, to Eleazar the priest, and to the congregation of the children of Israel, to the camp in the plains of Moab by the Jordan, across from Jericho" (Numbers 31:7-12).
By the way, this wasn't a complete destruction of Midian, the nation continued to exist for many years thereafter. However, it did take out their center of power and weakened them for a long time. Moses was not happy with the choice to save the women from death because they were involved in causing Israel to sin. Balaam's plan was to introduce idolatry into Israel, particularly idols "worshiped" through fornication. It was because sex was involved that it made rapid in-roads in Israel. "And Moses said to them: "Have you kept all the women alive? Look, these women caused the children of Israel, through the counsel of Balaam, to trespass against the LORD in the incident of Peor, and there was a plague among the congregation of the LORD. Now therefore, kill every male among the little ones, and kill every woman who has known a man intimately" (Numbers 31:15-17). The women were killed because of their general involvement in causing Israel to sin.
The rule of warfare that was being enforced was:
"Now if the city will not make peace with you, but makes war against you, then you shall besiege it. And when the LORD your God delivers it into your hands, you shall strike every male in it with the edge of the sword. But the women, the little ones, the livestock, and all that is in the city, all its spoil, you shall plunder for yourself; and you shall eat the enemies' plunder which the LORD your God gives you. Thus you shall do to all the cities which are very far from you, which are not of the cities of these nations. But of the cities of these peoples which the LORD your God gives you as an inheritance, you shall let nothing that breathes remain alive, but you shall utterly destroy them: the Hittite and the Amorite and the Canaanite and the Perizzite and the Hivite and the Jebusite, just as the LORD your God has commanded you, lest they teach you to do according to all their abominations which they have done for their gods, and you sin against the LORD your God" (Deuteronomy 20:12-18).
Normally the women and children would have been kept alive, but because of the crime Midian had done, the intended punishment was to treat Midian like one of the corrupt Canaanite nations that Israel was supposed to depose. It should have been a complete death sentence, but what was settled on was a sparing of the women and female children who were clearly not involved in the introduction of idolatry. "But keep alive for yourselves all the young girls who have not known a man intimately" (Numbers 31:18).
That was a long introduction to point out one simple fact: there is no mention of rape in this text. In fact, it can be proved that rape did not take place because the women and female children who were kept were the ones who had not experienced sex. You assumed that rape took place simply because that is what others would have done, not because this is what the text says.
Those taken in wars became slaves in Israel. These women, when old enough, were eligible for marriage. "When you go out to war against your enemies, and the LORD your God delivers them into your hand, and you take them captive, and you see among the captives a beautiful woman, and desire her and would take her for your wife, then you shall bring her home to your house, and she shall shave her head and trim her nails. She shall put off the clothes of her captivity, remain in your house, and mourn her father and her mother a full month; after that you may go in to her and be her husband, and she shall be your wife" (Deuteronomy 21:10-13).
Having sex outside of marriage has always been a sin (Exodus 20:14). Under the Old Testament law the punishment varied based on the circumstances, and being at war was not considered an exception.
When David sinned by committing adultery and furthered sin by trying to hide his sin by committing murder and marrying the murdered man's wife, the Lord stepped in to punish David for his crimes.
"'Why have you despised the commandment of the LORD, to do evil in His sight? You have killed Uriah the Hittite with the sword; you have taken his wife to be your wife, and have killed him with the sword of the people of Ammon. Now therefore, the sword shall never depart from your house, because you have despised Me, and have taken the wife of Uriah the Hittite to be your wife.' Thus says the LORD: 'Behold, I will raise up adversity against you from your own house; and I will take your wives before your eyes and give them to your neighbor, and he shall lie with your wives in the sight of this sun. For you did it secretly, but I will do this thing before all Israel, before the sun'" (II Samuel 12:9-12).
While God does not do evil, "Let no one say when he is tempted, "I am tempted by God"; for God cannot be tempted by evil, nor does He Himself tempt anyone" (James 1:13), He does make use of evil people to accomplish His tasks, including the punishment of sin. This was the reason God told Habakkuk that He was going to allow the Babylonians, a nation more sinful than Israel to destroy Israel because of their sins (Habakkuk 1:6-11). Yet the Babylonians would not escape punishment just because God made use of their evil tendencies (Isaiah 13:1-11).
Though David was a man after God's heart and the king of God's people, he wasn't excused for his sins. God doesn't play favorites. David weakened his authority by his willingness to break laws on his own behalf. Because of that God wasn't going to protect him from harm, instead, God made use of the situation to let someone evil in David's own household rise to power. And his actions would serve as punishment for David's sins. Like the Chaldeans, God isn't saying He is forcing the rebellion, He is stating that he would cause the circumstances to come about. The people involved still made their own free choices. God just knew people well enough that He could state with certainty the results.
"And Ahithophel said to Absalom, "Go in to your father's concubines, whom he has left to keep the house; and all Israel will hear that you are abhorred by your father. Then the hands of all who are with you will be strong." So they pitched a tent for Absalom on the top of the house, and Absalom went in to his father's concubines in the sight of all Israel" (II Samuel 16:21-22).
Once again, you stated something that is not supported by the text. You claimed that Absalom raped his father's concubines. The text makes no mention of this. It doesn't say the sex was forced. In fact, to make the statement that Absalom had replaced his father, it was to his advantage that the sex was consensual because it would indicate that even David's own wives had abandoned him. But the text doesn't say the sex consensual either.
When David returned to power after the death of his son, those ten women were sent into seclusion because of what they did. "Now David came to his house at Jerusalem. And the king took the ten women, his concubines whom he had left to keep the house, and put them in seclusion and supported them, but did not go in to them. So they were shut up to the day of their death, living in widowhood" (II Samuel 20:3). If it had been rape, under the Old Law they would have been assumed innocent. If it was consensual, they were supposed to be stoned. Since it wasn't provable whether the sex was consensual or not. David selected a consequence that was in between.
Notice that in the end, everyone was punished for his own choices. David suffered, Absalom died as did his councilor, and the women were sent to seclusion. God said in advance how the events would play out, but those who did the deeds were willing participants, God merely made use of what they were inclined to do.