The word "unnecessarily" means something is done in a way that is not needed or not essential. Therefore, a synonym for "unnecessarily" would be "pointlessly."
Here's an example sentence to illustrate the meaning: "Why is it that waiting for an appointment seems to take an unnecessarily long time?" In this sentence, you could replace "unnecessarily" with "pointlessly" and it would still make sense: "Why is it that waiting for an appointment seems to take a pointlessly long time?"