If a girl gets married but isn’t mentally matured but later in life gains maturity and accepts the marriage is the marriage still valid?

It depends what you mean by maturity. Was it to a point that she didn’t know what she was doing? Also, if her father approved of her marriage, and he deemed that it was in her interest to get married, then the marriage is valid.