Refer to the Gemoro in Sanhedrin 92a:
אמר ר' טבי אמר ר' יאשיה מאי דכתיב (משלי ל, טז) שאול ועוצר רחם ארץ לא שבעה מים וכי מה ענין שאול אצל רחם אלא לומר לך מה רחם מכניס ומוציא אף שאול מכניס ומוציא
§ The Gemara returns to the topic of the source for resurrection in the Torah. Rabbi Tavi says that Rabbi Yoshiya says: What is the meaning of that which is written: “There are three that are never satisfied…the grave, and the barren womb, and earth that does not receive sufficient water” (Proverbs 30:15–16)? And what does a grave have to do with a womb? Rather, they are juxtaposed to say to you: Just as a womb takes in and gives forth, so too a grave takes in and also gives forth, with the resurrection of the dead. (Sefaria translation and notation)
Alternatively, the womb is to be seen as a child's "ticket" out to the world. Providing it is open, there is access to the world but once closed that's it. It can be seen an expression that is relevant to the unfortunate circumstance where there is a still birth. In such a situation the child is essentially born dead and thus the womb is its grave - For example, refer to the Mishnah in Ohalos 7:4
Building on this line of thinking, we can quote Yirmiyahu 20:17, where it writes:
אֲשֶׁ֥ר לֹא־מוֹתְתַ֖נִי מֵרָ֑חֶם וַתְּהִי־לִ֤י אִמִּי֙ קִבְרִ֔י וְרַחְמָ֖הֿ הֲרַ֥ת עוֹלָֽם
Because he did not kill me before birth so that my mother might be my grave, and her womb big [with me] for all time.
Radak writes there the following:
שאם מותתני קודם צאתי מרחם היתה לי אמי קברי
That if I was dead before I came out of the womb that my mother would be my grave.