The answer might be affected by your job duties, and what you mean by a demotion. But if they did discriminate against you on the basis of pregnancy, that may well support a lawsuit against them. If you can demonstrate a pattern of similar demotions of pregnant women, and have witnesses who verify the motive, any case of illegal discrimination would be made stronger.

You should consult a plaintiff-side employment lawyer in your state.