Deuteronomy, Chapter 23 has more sets of obscure rules. Here they are:
Preserving the Male Genetic Line
1. A man whose testicles are injured must not be admitted into the congregation of Yahweh.
2. Bastards (male children without fathers) cannot be admitted into the congregation of Yahweh.
3. Moabites and Ammonites may never be admitted into the congregation of Yahweh, even later generations.
4. But the third generation of Edomites and Egyptians can be admitted into the congregation of Yahweh.
5. Any male who has a wet dream is unclean until the evening (and after he's washed himself).
These four rules seem to be geared toward assuring that the male Israelite genetic line is preserved. Men with injured testicles cannot reproduce and bastards can not carry their family line. Wet dreams, I'm not sure but I suppose they thought it was 'unclean', which I suppose it is. But to wait until nighttime to come back to the camp?
The Moabites and Ammonites dared to go to resist the Israelites, but the Edomites are the descendents of Esau, who was the brother of Jacob, one of the founders of the Israelite people. So, the logic is that the Edomites are technically related to the Israelites.
The mercy to the Egyptians follows different reasons, though. It is because the Israelites, even though they were in captivity by the Egyptians, were "strangers in their land." Maybe someone else can explain the reasons in that one.
So that Yahweh doesn't step in human feces, it is advised in Deut. 23:12-14 to carry a shovel with you and poop outside of the camp. Some people call this Doodooronomy. This raises an interesting question, did the Israelites think Yahweh has a physical body that can actually step on crap?
Freeing the Slaves
Here's a nice rule. Deuteronomy 23:15-16 says that if a slave runs away from his master, the Israelite shouldn't return the slave, but rather let him stay with him in his house.
Intolerance in the Bible
Whores, Dogs, and Sodomites shouldn't be allowed inside the house. Whores and Sodomites I understand; but dogs? Dogs is the Israelites' derogatory word for homosexual. Essentially, it's like saying, "Don't let those flaming faggots live in your house!"