The males of the nations of Ammon and Moab were forbidden from converting and joining the Jewish people. This is because they refused to assist the Jews when they left Egypt. Ammon and Moab are descendants of Abraham’s nephew Lot. As kin, they should have met the Jews with bread and water; instead, they greeted them with warfare. Moab even hired the pagan astrologer Balaam in an attempt to curse the Jews!
Since the males of Ammon and Moab showed themselves to be thoroughly corrupt, they may never join the Jewish people. The females, however, had no part in the aggression of their fathers, brothers and husbands. Therefore, they are not barred from converting and joining the Jewish people. In fact, not only is Ruth a famous Moabite convert, she is the ancestor of the Davidic (and therefore Messianic) dynasty.
This mitzvah only applied before Sennacherib, king of Assyria, mixed up the nations he had conquered, as described in the later chapters of II Kings. (It was at this time that the ten Tribes were “lost.”) Though the descendants of Ammon and Moab are completely unidentifiable, they are definitely in the minority of the population. Therefore, converts may be accepted without concern for this matter.
This prohibition is discussed in the Talmud in the tractates of Brachos (28a), Yevamos (76b-77b) and Kiddushin (74b-75a). It is codified in the Shulchan Aruch in Ever Ha’Ezer 4. This mitzvah is #53 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.