The best way to judge whether margarine is vegetarian is to look at its ingredient list.

Vegan margarine should not contain the following animal-derived ingredients:
Whey: This is the liquid separated from milk during the cheese making process.
Casein: These are the remaining lumps after the milk has condensed into cheese.
Lactose: This sugar is naturally found in milk and dairy products.
Animal fat: Margarine was originally made from animal fat, such as cow, duck or sheep, and some still contain this fat.
Vitamin D3: This vitamin is usually made of lanolin, which is extracted from sheep’s wool.
In addition, many brands now indicate on the packaging whether their margarine is vegetarian.