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 is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
It is forbidden for a Muslim to follow the funeral procession of a non-Muslim or take part in his burial even if he is his neighbor. A Muslim has to leave these matters to those who are of the same religion as the diseased person. This is the opinion of the majority of the Muslim scholars. Shaykh Al-Islam Ibn Taymiyyah was asked about the Muslims who have Christian neighbors, should a Muslim visit a Christian if he is sick? Or should he escort his funeral if he dies? Whether a Muslim who does so is sinful or not? He said: 'He should not follow his funeral procession, but he may visit him when he is sick since he may be inclined to Islam by this action. If he dies on disbelief surely he will enter the Hell so, the prayer is not performed on him.' [End of quotation]
However, some Muslim jurists allowed following the funeral procession of non-Muslim relatives depending on the narration of Abu Waa'il who said: "When my Christian mother died I went to 'Umar and informed him that. He said to me,'Ride on your animal and walk in front of the funeral."
As long as you followed the funeral without knowing that it was for a disbeliever then there is no harm. Allaah Says (which means): {And there is no blame upon you for that in which you have erred but [only for] what your hearts intended. And ever is Allaah Forgiving and Merciful.}[Quran 33:5].
Allaah Knows best.