It's fine to eat peanuts during pregnancy, unless of course you're allergic to peanuts yourself. There's no evidence that eating peanuts, or foods containing peanuts, while you're pregnant affects whether or not your baby develops a peanut allergy.
The government used to advise pregnant women with a family history of allergies, such as asthma, eczema, or hayfever, to consider not eating peanuts. This advice changed in 2009 because of the lack of evidence that eating peanuts increases your baby's risk of allergy, even if you have a family history of allergies.
Nevertheless, you may still feel reluctant to eat peanuts, or foods containing peanuts, such as peanut butter. Talk to your GP or midwife if you have a family history of allergies and are worried. As long as you're eating a healthy, balanced diet, excluding peanuts from your diet certainly won't do you or your baby any harm.
Some experts suggest that eating peanuts during pregnancy may even make your child less likely to develop a peanut allergy. Children from cultures who eat peanuts from an early age seem to be protected against the allergy, though more research is needed.
source: https://www.babycentre.co.uk/