Sufyan bin Uyaynah (may Allah have mercy on him) said: I heard al-Zuhri (may Allah have mercy on him) say: The people of Iraq claim that the testimony of one who has been given a hadd punishment is not permissible. I inform you that Umar bin al-Khattab (may Allah be pleased with him) said to Abu Bakrah (may Allah be pleased with him): Repent, and your testimony will be accepted; or: If you repent, your testimony will be accepted.
(b) The huffaz narrate it from Hadrat Sa'id (may Allah have mercy on him) without doubt, and in it is the addition that Hadrat Umar bin al-Khattab (may Allah be pleased with him) asked the three to repent; two repented and their testimony was accepted, and Abu Bakrah (may Allah be pleased with him) refused, so his testimony was rejected.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 20545