Adam and Eve were forbidden from eating from the tree of the knowledge of good and evil, not from the tree of life before the Fall (Genesis 2:16-17). In Genesis 2:9, the sense is that both the tree of life and the tree of the knowledge of good and evil are in the midst of the Garden; it's the latter tree to which Eve is referring in Genesis 3:2-3.
The tree of life gave life, and it is for this reason that God expelled Adam and Eve from the garden after their sin (the "Fall"). Their sin brought separation among them and between them and God. So, God prevented them from eating from the tree of life (by casting them out from the garden), lest they live forever alienated from Him and from other people (see Genesis 3:22-23).
However, He promised a Savior who would ultimately undo this alienation by reconciling humanity to God and to each other; this is the promised "seed of the woman" (Genesis 3:15). This is what Christ accomplished on the cross, and at the resurrection we will again be allowed to eat from the tree of life to live forever.
The Catechism of the Catholic Church talks on this subject in the section about Original Sin at this link: Catechism of the Catholic Church, Paragraph &: The Fall.
How to read the account of the fall
CCC 390 ... Revelation gives us the certainty of faith that the whole of human
history is marked by the original fault freely committed by our first
THE FALL OF THE ANGELS
391 Behind the disobedient choice of our first parents lurks a seductive voice, opposed to God, which makes them fall into death out of envy. Scripture and the Church's Tradition see in this being a fallen angel, called "Satan" or the "devil". (skip a bit)
392 ... This "fall" consists in the free choice of these created spirits, who radically and irrevocably rejected God and his reign. We find a reflection of that rebellion in the tempter's words to our first parents: "You will be like God." The devil "has sinned from the beginning"; he is "a liar and the father of lies".
393 It is the irrevocable character of their choice, and not a defect in the infinite divine mercy, that makes the angels' sin unforgivable.
394 Scripture witnesses to the disastrous influence of the one Jesus calls "a murderer from the beginning", who would even try to divert Jesus from the mission received from his Father. "The reason the Son of God appeared was to destroy the works of the devil." In its consequences the gravest of these works was the mendacious seduction that led man to disobey God. (skip a bit)
III. ORIGINAL SIN
Freedom put to the test
396 God created man in his image and established him in his friendship. A spiritual creature, man can live this friendship only in free submission to God. the prohibition against eating "of the tree of the knowledge of good and evil" spells this out: "for in the day that you eat of it, you shall die." The "tree of the knowledge of good and evil" symbolically evokes the insurmountable limits that man, being a creature, must freely recognize and respect with trust. Man is dependent on his Creator, and subject to the laws of creation and to the moral norms that govern the use of freedom.
(Full disclosure: I am a Lutheran pastor and not Roman Catholic)