How long can a mosquito fish be pregnant?

If by "mosquito fish" you mean Gambusia then their gestation period is around 30 days depending upon temperature. They can hold on to their young if conditions are not to their likeing and can sometimes die rather than give birth.