Allah, exalted be His praise, says: "And do not pursue that of which you have no knowledge. Indeed, the hearing, the sight and the heart, about all of these there will be questioning." [Surah al-Isra': 36]
And He said: "Except those who testify to the truth while they know." [Surah al-Zukhruf: 86]
And in the story of the brothers of Yusuf (peace be upon him) He said: "And we have testified only to what we know, and we were not guardians of the unseen." [Surah Yusuf: 81]
Imam al-Shafi'i (may Allah have mercy on him) said: "It is not permissible for a witness to testify except to what he knows."
Abd al-Rahman bin Abi Bakrah narrates from his father (Sayyiduna Abu Bakrah, may Allah be pleased with him) that we were with the Messenger of Allah (peace and blessings be upon him), and he (peace and blessings be upon him) said: "Shall I not tell you about the greatest of the major sins? (1) Associating partners with Allah, (2) disobedience to parents." He (peace and blessings be upon him) was reclining; then he sat up straight and said: "(3) False testimony, false testimony, false testimony," or (he said): "false speech." He (peace and blessings be upon him) kept repeating it until we said: If only he (peace and blessings be upon him) would fall silent.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الشهادات / 20578