Broadly speaking, "defilement" is a term used to denote exposure to outerworldly. It has certain effects on one`s magic power and sanity.
Generally, defilement may occur from any perception of outerworldly. The caveat here is that subject of defilement must be experiencing cognitive dissonance for it to kick in. For example, a rock taken from other world will not cause defilement if it`s characteristics are comparable to native rocks.
Low-key defilement can be accrued by performing research on otherworldly minerals and flora. It must be said that researcher has to be meticulous enough to uncover the facts that do not permit mundane explanation. Justy comparing the rocks and herbs is not sufficient, researcher in question must clearly pinpoint the outerworldly properties that could not be located in native dimension. Amassing sufficient knowledge to gain a comprehension on how a different world might have functioned is slow and safe method of increasing magic power. Chances to go mad are very low, but one has to somehow source the otherworldly materials to examine. It might be more then a little expensive.
Actually opening portals to different worlds is more intensive option. Depending on how similar the alternate dimension is, the results may range from "didn`t notice difference" all the way to "went mad from revelation". Another concern in this is the hostility of environment beyond the portal.
Peering in the void between the worlds or beholding the void-native beings (like shoggoths) is high-intensity, high-impact option. Surprise peek usually results in gibbering lunacy. Preparations can be done to mitigate this, but the likelihood of going crazy is still in the vicinity of seven out of ten. Usual preparations include researching the theory, studying first-hand accounts of those who survived exposure with sanity intact and low-level exposures.
Madness is primarily caused by cognitive dissonance and fear of unknown. It is possible to greatly decrease the chances of madness by ensuring the "unknown" is viewed with yearning or affection instead of fear, but this is both complicated and has it`s own hazards. It is highly likely for subject that was exposed to outerworldly object they view with affection to develop an obsession over it. Even if that does not happen, all defiled share a certain pining for seeing more of what they glimpsed. This urge can range all the way from subconscious interest to manic obsession.
Due to improved comprehension of reality`s plasticity and fragility, one`s grasp of magic improves significantly. Aside from obvious power boost, defiled also tend to have better instinctual grasp of basic magics and are much more apt with conjuration, evocation and alteration.
"Cats can be bats can be rats can be brats, can be thises, can be thats."
C) Social reaction.
Defiled are not a subject to any social stigma by themselves, they are actually pretty sought after by royals and high nobility as they tend to make terrifying court mages and excellent scholars.
The process of attaining defilement, however, is subject to certain stigmas.
To begin with, any intentional self-defilement is viewed as reckless. A common practice to address this is to seclude oneself while attempting to glimpse beyond the world.
Doing self-defilement experiments in densely populated places is heavily frowned upon as reckless endangerment, due to the fact that random bystanders caught by surprise will almost certainly go insane. There exist legends about certain mages who had intentionally caused this kind of exposure in public places like bazaars and plazas. It is considered a high crime to do that with intent.
Exposing someone else to defilement against their will is generally a crime, and is punished by public lashing. As noble may not be lashed by commoner, nobles also lose their personal patent of nobility if caught doing this. If subject of defilement were one`s own children, the custody of them is stripped and children are handed over to closest relatives or lord of the domain to be adopted as branch family or domestic servants, depending on one`s social status.
It is unfortunate truth that many kings elect to look the other way if a noble manages to successfully cause defilement in their children. It is also tacitly understood that children may revenge themselves over this, and neither is looked into by kings much. It is, as a rule of thumb, considered "family matter".