ואלה ימי שני חיי אברהם אשר חי מאת שנה ושבעים שנה וחמש שנים. What are the extra words אשר חי? The midrash comments on the wholeness of Sarah's life and Rashi comments כולן שוין לטובה. How were they all so great if she lived through many troubles? ואברהם זקן בא בימים, the chassideshe seforim explain that Avraham was able to bring his days with him, each day was accounted for and had accomplishments. Similarly, the midrash calls the days of Sarah תמימים. How are the lives of Avraham and Sarah who only recognized Hashem mid life totally complete? In other words there are two questions. Number one there life wasn't always good so how is it all considered לטובה and number two how is it considered תמים, as if every second was perfect if they lives some years without even knowing about Hashem?
When one is on a path to get to the right way then even the struggles on the way to get there are part of the accomplishment. Even though Avraham and Sarah may themselves have taken some time to recognize the truth, since they were looking for Hashem, the journey until they got their is also called completely fulfilled. As long as one is trying to do things right even the mishaps in the beginning are called תמים. Since the whole essence of the lives of Avraham and Sarah was to find spirituality, therefore the fact that they had all sorts of hardships, moving around, being challenged by everyone, captured etc. did not effect them because that was not the focus of their lives. Since the pnimiyus of their lives was so focused on their goal everything else that happened paled in comparison (based upon Likutay Sichos Vaerah volume 35 and Sfas Emes our parsha.)