Aly was ten years old when Mohammed assumed the prophetical office, and the first prayer he performed with the prophet was two rukats at noon. For the period of ten years, when the people began to embrace the faith, the Most High made it obligatory on all Musulmâns at Mekkah to perform two rukàts in every prayer, which law continued till the Hijret. Mohammed left Mekkah on the first day of Rabeea-ul-evvel, and arrived at Medeenah on Monday, the twelfth of the month after meridian.
The prophet remained, according to one account, fifteen days with the Benee Ameer-bin-Auf, who offered to build him a mesjed if he would dwell with them, but he refused, saying, I only wait here the arrival of Aly-bin-Abutâlib. When he caine with him, and mounted on the same she-camel he had rode from Mekkah, the prophet entered Medeenah on Friday, having started at sunrise, and stoTh ped with the Benee Sâlim-bin-Auf till afternoon prayers. Every clan of the Ansârees came out and besought him to become their guest, but he replied, Open a way for my camel; she is under divine guidance, and will go to the place God has appointed me. At the same time he threw down the reins, and let the camel take her own course. Here she stopped, said the imam Zayn-ul-Aubideen, pointing to the door of the prophet's mesjid, where prayers over the dead are recited. The camel lay down and Mohammed dismounted. Abuiyoob, an Ansâree, anticipating the rest, seized and carried the prophet's things to his house, and had Mohammed for his guest till houses were built for him and Aly.
In this year, the first of the Hijret, the prophet was commanded to fight for the faith. Abubekr was angry that Mohammed waited for Aly before entering Medeenah, and conceived great jealousy of him. Aly married Fàtimah one year after the Hijret, when she was nine years old. She was Mohammed's only child by Khadeejah, after his assumption of the prophetical office.
The people of Medeenah had broken their idols on becoming Musulmâns, and after the prophet's arrival among them, the faith spread to that degree that two of his followers went about and broke all the idols that remained. He entered Medeenah one or two days after the coming of Aly. When the prophet's camel lay down at the door of Abuiyoob, the man called to his mother to open the door, for the prophet had come to them. She being blind, lamented the loss of her sight that she could not see him. Mohammed drew his hand over her eyes, and her sight was restored. This was his first miracle in Medeenah. At this city dwelt three tribes of Yedoodees, who sent delegates to Mohammed, and being satisfied that he was the predicted prophet, made a truce with him, but were hostile at heart. These tribes were the Benee Kareezah, Benee Nazeer and Benee Keenkau.
The prophet performed prayers a number of times in the house of Abuiyoob. He then directed Asad-bin-Zarârah to buy a certain lot of ground for hint. Asad went to negotiate the business with the two orphans that owned it, and who immediately declared it a present to the prophet. He refused to receive it without paying its value, and the bargain was at length closed by the payment of ten ashrafees. Mohammed ordered bricks to be made on the ground, and stones were brought to lay the foundation of a mesjid, he toiling with the rest in this laborious work. Asayd-bin-Khuzayr seeing him carrying a heavy stone, said to him, Let me carry it, O prophet of God. No, he replied, do you go and bring another. When the foundation was brought up to the level of the ground, they then built of sun-dried brick. The walls were at first the thickness of a single brick's width, but on the increase of the Musulmâns, the mesjid was enlarged, the walls being made a brick and a half in thickness. On a further increase of members, they besought the prophet to allow another enlargement of their place of worship, when he ordered the walls to be built two bricks thick, in that style in which the joints of one layer are covered by the bricks of the next course. As the heat became oppressive, the Musulmâns petitioned for a roof to the mesjid. Mohammed ordered date-posts to be set up to support date-rafters, and a thatch of date-leaves and grass. When the rainy season commenced, the Musulmâns proposed to protect themselves by a clay roof, but the prophet ordered the roof to be of wood, bound together like that Moosâ made, adding, More than this I shall not do for the mesjid; and it remained in that state till he left the world. The walls, before the roof was put on, were the height of a man. When the shadow of the wall extended one cubit, noon-prayers were performed, and on the further extension of a cubit, the afternoon prayers were offered.
source : http://www.imamalinet.net