All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and messenger.
If the deceased is buried, he should be respected and left and it is impermissible to open his grave once again unless there is a dire necessity. Also, burying the deceased in the direction of the Qiblah is recommended and an act of the Sunnah and not one of the necessities for which the grave should be dug. Ibn Abi Zayd Al-Maaliki said: “It is recommended to make the dead lie in his grave on his right side facing the Qiblah because it is the noblest direction.”
If there is a mistake in the burial and the deceased is not directed toward the Qiblah, this should be fixed before the burial is over and the deceased should be left alone once it is. According to Khaleel Al-Maaliki “The deceased should be made to lie on his right side facing the Qiblah and, if this is violated, it should be fixed as long as the earth has not yet been leveled on him (otherwise he should be left alone).”
So what you should do is simply ask forgiveness for, and give in charity on behalf of, the deceased. It is impermissible to open his grave and there is no need to make a mention of what happened since no benefit is expected from it.
Allaah Knows best.