Yes, you are allowed free prescriptions.
You are entitled to the free prescriptions because you are pregnant (i.e. a medical reason), not because of your income . Therefore it is not considered a public fund to get the free prescriptions.
The same would apply if you had a particular medical condition (like diabetes, certain thyroid conditions, cancer etc.)... you would still be entitled to free prescriptions, regardless of the fact that you have a visa (and also because you have paid the IHS surcharge which allows you to access these NHS services)