Not all custards are safe during pregnancy. Specifically custards that are made using eggs are not considered safe during pregnancy especially if they are homemade.
Egg custard recipe includes raw eggs and they are only safe if prepared using pasteurized eggs. As per USFDA, all egg products sold in the US need to use pasteurized eggs. This means any pre-packaged custards available in stores or groceries are safe as they use pasteurized eggs.
The same pasteurized eggs may not be available for home use as only some shell eggs are pasteurized. It is likely that the eggs you use at home are not pasteurized kind. Check the label for details. These eggs are meant to be cooked thoroughly before eating to make them safe. This means that home made custards may not be safe as the eggs are still partly raw in egg custard recipes.
Non egg based custards such as those made using corn starch or custard powder are safe to have during pregnancy.
Baked custards such as Creme Brulee are a safer choice during pregnancy. Read more about them in our article.