> I am fully in favor of legalized abortion, but why was it never codified in law?
The US constitution made leeway for rights to be unenumerated, or not explicitly spelled out (9th amendment [1])
Up until this current supreme court, a right has never been removed. That was not standard jurisprudence.
Now, however, we have radicals on the court who take the view that "if it's not in the text, it isn't protected" completely ignoring the 9th amendment and often only applying it when they favor the text ideologically (see: gun laws. Plenty of historical documents show that the 2nd amendment was about states being able to form militias and not arming individuals. It literally wasn't until about the 1990s that lobbying from the NRA successfully reinterpreted the amendment to mean "everyone gets a gun").
The next problem is that in order to pass new laws, you need to have a super-majority in the senate, a majority in the house, and the presidency to go along with the law. Pretty difficult when the republican party has decided they want absolutely no new laws and certainly no expansion of rights. (See: how hard they are fighting against the HR-1 the voter rights act [2])
But, of course, while abortion rights are wildly popular (~80% of the population supports them in some circumstances. ~50% in all circumstances [3]), we don't run the country as a democracy, but rather a representative republic. And that's the problem. While the people want this, the representatives do not. A combination of gerrymandering and voter suppression has angled them into a position where the population that elected them doesn't track with the general population.
This is exactly the same issue with climate change. 60% of the population view it as a dangerous problem and 40% of the population view it as overblown. [4] That 40% ends up with a larger portion of power in the senate because any action to realistically curtail climate change ends up being filibustered.
The issue america has is we have 1 party with the motto that "The scariest phrase is I'm from the government and I'm here to help" as such, they block any and all regulations and government actions they can feasibly stop. The setup of our government favors that strategy. Their voters don't CARE that they aren't passing laws, they prefer it that way. This kills the ability to compromise.
[1] https://www.law.cornell.edu/constitution/ninth_amendment
[2] https://cha.house.gov/hr-1-people-act
[3] https://news.gallup.com/poll/1576/abortion.aspx
[4] https://news.gallup.com/poll/1615/environment.aspx