First, I'm not surprised you're devastated. It's an awful thing to happen and it so clearly knocks your confidence, even if you know deep down it's not true.
Second, I suggest getting advice. Pregnant then Screwed is an excellent charity as a first port of call. Then somewhere like Bellevue Law for action. It may be that you are out of time to file a claim, but at least explore your options.
Thirdly, take a breath. It's not clear if you are working at the moment or looking to work, but there are plenty of ways back into law. You may find (like many of us have) that in-house is a good option for you. There are also many "lawyers on demand" type places where you can do shorter placements, build up your confidence again, and get some in-house experience. Obelisk and Axoim both come recommended. Also, if you're interested in in-house, join various communities, like Crafty Counsel or the Heriot Brown WhatsApp groups to look at roles and general support.
You are not alone in this. Law firms have often behaved abysmally towards senior women, especially mothers. It's fine to smudge the reasons for exit - young family, looking for a more varied career, exhausted by private practice - these are all true if not the whole truth.
George Eliot is good on this:
“We mortals, men and women, devour many a disappointment between breakfast and dinner-time; keep back the tears and look a little pale about the lips, and in answer to inquiries say, "Oh, nothing!" Pride helps; and pride is not a bad thing when it only urges us to hide our hurts— not to hurt others.”