You are right in that the skin is designed to keep things out.
This is why most medications cannot be meaningfully delivered across the skin, for example micronised progesterone as the molecules are too large, and those that have been developed for this route display very high variability in absorption between individuals.
For example the amount of estrogen absorbed from a particular strength patch has been shown to vary at least tenfold between different patients. Some can apply very high doses to the skin and still have estradiol levels in the postmenopausal range.
However a lot of women and prescribers are highly motivated to struggle on with inefficient, costly and high maintenance transdermal estrogen due to greatly exaggerated concerns about the difference in thrombotic risk vs oral - tablets cause around one extra blood clot per 5,000 users - whilst risking a much more serious outcome in my opinion which is undertreatment.
Magnesium in various forms is extremely safe and effective taken orally, and whilst I don't know about any scientific studies regarding its ability to cross the skin, I have to take magnesium (and potassium) for medical reasons as I am on fludrocortisone, and I would absolutely not rely on transdermal products.