First and foremost, my family had scheduled my Mecca trip onea year earlierago, byat which time we never had anyno idea that it would clash with my exam.
If you want to keep the same sentence, I suggest the changes in green.
First and foremost, my family had scheduled my Mecca trip onea year earlier ago, byat which time we never had anyno idea that it would clashinterfere with my exam.
Otherwise, I suggest:
My family had sceduled my Mecca trip in advance last year, when we didn't knew the exam schedule.
(I don't know the rest of your text, but I don't like the use of first and foremost, because it sounds intimidating, especially if you want a professor to excuse you due to a trip planned in advance.) Just my opinion....