The human spirit is formed in the body!
Imam Ghazali also explains the human spirit is formed after the formation of the body in the mother’s womb, and the idea of spirits being created earlier and then sent to earth gradually is nonsense:
Based on the teachings of the Rasul of Allah (saw) and as Ghazali explains in his book Rawzatu’t Talibeen, the spirit-body is inexistent before the biological body is formed.
Spirits are not created elsewhere and then sent to the bodies as they come to earth, this idea is totally incorrect. This view goes back earlier than Islam, to certain Buddhist philosophies. To keep the poverty stricken people away from rebellion, they were made to believe they will be rewarded with wealth and the chance to come back to earth with a better body and better living conditions if they were to consent to their current state and be patient… After which, various ideas of reincarnation were introduced, i.e. that one can come back to earth with a new body after death…
According to Islam, this idea is a complete fabrication and absolutely invalid.
Reincarnation is advocated by those who engage in necromancy and who claim they are the reincarnated body of Rumi or other scholars and saints, or sadly, by those who have become possessed by jinn.
In 1972, I explained in my book Spirit Man Jinn what the spirit is, how it’s formed and why reincarnation isn’t possible. More information can be obtained from there, for now I’ll only a share a few points.
The spirit of each person is formed by the brain in the mother’s womb as a result of certain cosmic effects, and at the time of death, it departs from the body and continues its life in its own dimension.
“When death comes to one of them, he says, “My Rabb, send me back (to the worldly life) so that I might do righteousness in that which I left behind (i.e. a faithful life that I did not heed or give importance to; the potential that I did not utilize and activate).” No! (It is impossible to go back!) His words are invalid! (His request is unrecognized in the system) and behind them is a barrier (an isthmus; a difference of dimension) until the Day they are resurrected (they cannot go back; reincarnation, being re-born for another worldly life, is not possible!).”
“None shall be brought back after death” (Hadith)
The verses and hadith make it evident there is no return to the worldly life after experiencing death.
The Rasul of Allah (saw), in terms of being Allah’s vicegerent (caliphate), was already determined in the knowledge of Allah as the composition and manifestation of Allah’s names, before Adam was created.
That is, Rasulullah (saw), the caliphate of Allah, was the first created meaning in Allah’s knowledge, though he was the last Nabi that became manifest on earth. The reality of Muhammad (saw) was first created in a perfect fashion in Allah’s knowledge, then Adam was formed from earth. Earth denotes the human body, that we perceive with our five senses and its water and mineral-based makeup.
This earthly makeup, comprised of water and minerals, works like a bioelectric factory; it converts the liquid and solid input into bioelectric energy and sends it to the brain. The brain works like a microcomputer; it receives the bioelectric energy and converts its data into a radial type of energy, which forms the holographic body called ‘spirit’ and also radiates this energy to its surroundings.
 Quran 23:99-100