Is it a correct sentence: Mr X is the 1st president of Germany paying a visit to France.
Maybe it's better to say: "... who is paying a visit to France".
In my opinion these two sentences have slightly different meanings:
*Mr X is the 1st president of Germany paying a visit to France.
*Mr X who is the 1st president of Germany, is paying a visit to France.
The first sentence implies that this particular president is the first president of Germany to pay a visit to France, (i.e. there were no other presidents of Germany to ever visit France before Mr X),while the second sentence is stating that Mr X is the first president of Germany and that he is going on a visit to France.
If the original intention is to say that there were no other German presidents who had been to France before, I would say: "Mr X is the first president of Germany to pay a visit to France". If the meaning is the other one then sarat_106's suggestions are fine.
*Not a teacher.
Situation 1: He is the first president of Germany. He is visiting France.
Mr. X, the first president of Germany, is visiting France.
Situation 2. He is the president of Germany. There have been other presidents before him, but he is the first one to visit France.
Mr. X is the first president of Germany to visit France.
You can "pay a visit" to someone, but it's used for a casual visit. I would not use it here. Presidents generally are not casual when they travel.
I'm not a teacher, but I write for a living. Please don't ask me about 2nd conditionals, but I'm a safe bet for what reads well in (American) English.