Can the Moshiach come in our time, even though there are people who have not yet repented and don't keep the Torah?
Regarding the coming of the Redemption, our sages taught: “This matter depends only on repentance.” Maimonides likewise writes that “The Torah has promised that the Jewish people will ultimately repent at the end of their exile, and will immediately be redeemed.” However, the Redemption will not be delayed even if this condition is not fulfilled. There are three reasons for this:
1) There is no one who has not had at least one thought of repentance at least a few times in the course of his life. Even one such thought can transform a person from an utter rasha to a perfect tzaddik.
2) Many of those who do not keep the Torah and its commandments were not raised in observant homes, and have not had the benefit of a comprehensive Jewish education. As such, they have the halachic status of victims of duress, and the Torah exonerates them for their lack of observance.
3) The Redemption will come even before the Jewish people repent. It is written in Psalms, “And He will redeem Israel from all its sins.” Commentators explain, “Even sin will not obstruct the Redemption, for He will redeem Israel from sin.”
G-d is merciful and overlooks transgressions, as described in the verse: “Who is a G-d like You, Who pardons iniquity, and forgives the transgression of the remnant of His heritage? He does not maintain His anger forever, for He delights in mercy.”
Rabbi David Kimche comments on this verse: “As to those people who remain when the Redeemer comes..... even though their unworthy deeds could make them liable for the punishment of not being redeemed from exile, G-d will not direct attention forever to their deeds, for He delights in mercy.”
[From Exile to Redemption, pp. 128-29. Sicha of Parshat Vayechi 5751. Shabbos 68b. Bava Kama 28b. Tehillim 130:8. Meztudas David, loc. cit. Michah 7:18]