What it is and where it comes from
Magnesium stearate is a salt of stearic acid and magnesium. It stops tablet powder from sticking to machines. In the EU it falls under E470b, elsewhere it is often numbered 572. The fatty acids can come from plant oils such as palm, soy, sunflower or rapeseed, or from animal fat, including pork fat. Most made today is from plants, but the label rarely says which.
Where you find it
Tablets, capsules, vitamins and supplements, and some sweets and powdered foods.
What to look for on the label
Supplements often say "vegetable magnesium stearate", which is halal. Otherwise look for a halal logo or a vegan label, or ask the maker.
This is a guide, not a fatwa. Recipes change, so check the label, look for halal certification, and ask your local imam where scholars differ.