Our immune system is a bit weak during this time to protect the baby, so we get coughs and colds easily. Please be very careful and ask your doctor before taking any cough syrup.
Lower immunity and nasal congestion are standard in pregnancy, which leads to a cough. Just do steam inhalation and don't go popping random over-the-counter syrups.
My MIL made warm turmeric milk (haldi doodh) for my cough, and it really helped. She always said pregnancy makes our bodies sensitive to weather changes.
Sometimes even acidity can trigger a dry throat and cough during pregnancy. Make sure you don't take sweet cough syrups without checking, especially if you need to monitor sugar levels.