The reason for opposition to intercaste-marriage in Hinduism is stated in the Shrîmad Bhagavadgîtâ.
Though these(the Kauravas & their allies) whose intelligence is stricken by greed, perceive no evil in the extinction of lineages & no sin in treachery to friends, yet O Janârdana, shouldn't we who clearly see evil in the extinction of a lineage, learn to refrain from this sinful deed ? On the extinction of a lineage, the immemorial dharmas of that lineage(kuladharma) disappear. When the kuladharmas disappear, impiety(adharma) overtakes the whole lineage. By the prevalence of impiety, O Krishna, the women of the lineage become corrupt. With the women corrupted, there will be varna-sankaras, O descendent of Vrishni ! Sankaras also leads the lineage of these destroyer of lineage to hell; for their forefathers fall down to hell, on extinction of the offerings of pinda & water to them. By these evil deeds of the destroyers of lineages which cause varna-sankara, the eternal dharma of all castes & lineages are subverted. We have heard O Janârdana, that men whose kuladharmas have been subverted, always reside in hell.[Bhagavadgîta:1:38-44]
Yet intercaste marriage is prevalent. Satyavati, born of the semen of a Kshatriya King placed within a fish & raised by a fisherman, was impregnated by Sage Parâshara, who was a Brahmin & their son, Sage Krishnadwaipâyana Vedavyâsa is revered as an incarnation of Bhagavâna Vishnu.
The chapters 13 & 14 of the Uttarakhanda of the Brihaddharma Purâna states that the higly irreligious king Vena forced people of one caste to have sex with those of other castes, in defiance of the existing laws, thereby creating the first varna-sankaras. His son Prithu assigned specific profession to those varna-sankara & prohibited further intercaste-union. The varna-sankaras were classified into :
● the superior varna-sankaras formed by the union of any 2 of the 4 original castes(Brâhmana, Kshatriya, Vaishya & Shûdra)
● the intermediate varna-sankaras formed by the union of a varna-sankara with any one of the 4 original castes.
● the inferior varna-sankaras formed by the union of persons of 2 different varna-sankaras & to some extent those who were born due to a lower caste man impregnating an upper caste woman. Incidentally, it includes groups like chandâlas who are considered as untouchables.
Some varna-sankaras were classified as Sat-Shûdras i.e they had the same status as that of Shûdras & Brâhmanas were allowed to interact with them. The Manusmriti (10:99-100) allowed Shûdras to take the profession of artisans in times of distress but artisan communities like masons, blacksmiths, goldsmiths, potters, tailors, basket-weavers, barbers etc were considered as varna-sankaras. This clearly diluted the difference between a Shûdra & a Sat-Shûdra now that they shared the same social status & profession. Prohibition over marrying outside one's own caste was observed only by the those communities who were considered superior in their regions & the untouchables.
According to the Baudhâyana Dharmasûtras (1:17:3-5), the offspring of a Brâhmana man & Kshatriya woman, a Kshatriya man & Vaishya woman becomes a Brâhmana & a Kshatriya respectively. Offsprings of all other intercaste-marriages are considered vrâtyas, who are excluded from the rites of being initiated in the Gâyatrî mantra, & hence by default, became Shûdras, if not untouchables.
So it can be concluded that intercaste-marriage marriage is allowed (if not frowned upon) under very restricted circumstances, but endogamy is highly appreciated for all castes.