I was wondering about Adam and Eve, and if they commited a sin/mistake when they ate the from the tree. They were destined anyway to go to earth. And he was still a prophet even in the heavens right?

From the beginning, Allah’s plan was for humans to be on earth. Adam could stay in that garden as much as he wanted (there was no difficulty and hardship in that garden). If he approached the tree, his worldly trial would start. Satan tricked him and his wife and told him if he wanted to stay longer he should eat from that tree. At that point Allah sent him down to earth. So he didn’t commit a sin, but rather he made a mistake by having his trial start faster. Yes, he was a prophet in that garden