And I say that because maybe, just maybe, the poorly phrased "I wouldn't have invested if I knew you were going to get pregnant" actually had to do with the founder not being able to "service" her company. Whether the founder could dedicate enough time, as perceived by said investor, is a relevant concern to that investor. Is that sexist? I'm not sure. Is it a shitty thing to say (in that way)? Most definitely. Is it wrong to use pregnancy as a "signal" (positive or negative) for investment? I have zero ideas considering I'm not an investor.
Again, that is not what is illegal. What is discrimination is to pick one candidate with equal background ability, and drive over another. Yes, it is wrong to use it as a signal for not being invested in a company.
Denying a black man or a woman when you grant the loan to someone with the exact credit history otherwise, for example.
If a single woman makes enough to pay the mortgage, you shouldn't be denying her the loan based on your moralizing on her inability to survive without a man's wages.