According to the Bible, the Moabites didn’t help the Israelites when they came out of Egypt. They opposed the Israelite invasion of Canaan. As a consequence, the law excluded any descendant of a Moabite to join Israel, down to the tenth generation. If they couldn’t even join the community, how could one of them serve as a king?