So I have a question regarding wishing something bad for someone. For example. If someone out of jealousy wished a person is dead and that person dies. Whats the islamic ruling on it? Like that person for example died the same day. An accident or natural causes. If he made dua that something happens to that person would he be accountable to anything?

If you see the verse 42 from Sura Zomar where it has clearly mentioned that at the time time of death Allah takes their soul back. But when we tak to the nature of God ( Sonan e Ilahi) it says that any one dies in this material world by one of the reason and that reason could be different.
Now as for as bad wishes or witch craft or magic are concerned, these all do exists but it’s not clear that any one can kill anybody just doing bad wish about him. In this world 2 things are working simultaneously that is cause and effect so for so any death, there should have been any natural reason. As as long as we are having material body the reason can also also material. According to islamic teaching, this material world is the place where Allah has sent us to achieve the aim of our life and become a perfect human being. Also if anyone has not done his duties properly or according to the guidelines of Shariaya he/she has chance up to his/ her last breath to repent and ask for forgiveness after which it depends on Allah’s mercy, does He forgive or not. But it’s clear that this world is the only place for practicing deeds ( either good or bad) therefore no divine punishment has been set as long as a person is alive so that he can’t make any excuse that he did not have enough chance to get repentance. All these shows that just by doing bad wishes if we start killing each other then what is the decree of Allah? There are two types of decree that has been fixed for every human:
1) We have given authority to live and do actions according to our own wish and will
2) Our destiny has been fixed by Allah so if we have not done any changes by doing good deeds our death which is certain will come. But still it would have a physical cause.

اللَّهُ يَتَوَفَّى الْأَنفُسَ حِينَ مَوْتِهَا وَالَّتِي لَمْ تَمُتْ فِي مَنَامِهَا فَيُمْسِكُ الَّتِي قَضَىٰ عَلَيْهَا الْمَوْتَ وَيُرْسِلُ الْأُخْرَىٰ إِلَىٰ أَجَلٍ مُّسَمًّى إِنَّ فِي ذَٰلِكَ لَآيَاتٍ لِّقَوْمٍ يَتَفَكَّرُونَ

Allah takes the souls at the time of their death, and those that die not during their sleep; then He withholds those on whom He has passed the decree of death and sends the others back till an appointed term; most surely there are signs in this for a people who reflect.(39:42)