Prophet Ayyub (AS) was the grandson of Prophet Ishaaq (AS), son of Prophet Ibraaheem (AS) and his wife was the granddaughter of Prophet Yusuf (AS). Allah gave him many blessings. He was a wealthy man with large flocks of sheep and a lot of land. He had many children and was well respected by his people.
Prophet Ayyub (AS) was generous with his wealth and took care of orphans and used to provide food for the poor. He was mindful of the needs of all and especially his relatives, whom he always treated kindly. For all his bounties, Prophet Ayyub (AS) remained ever grateful to Allah.
On seeing the devotion of Prophet Ayyub (AS) to Allah, Shaitaan decided to try to lead him astray. Since he was dealing with a Prophet, Shaitaan requested Allah for power over Prophet Ayyub (AS)'s affairs and said, "O Allah, while Ayyub enjoys your blessings he remains grateful to you. But give me control over his affairs and I will make him turn away from you."
Allah was fully aware of the patience and steadfastness of Prophet Ayyub (AS), but as a trial for His Prophet and as a lesson for mankind, he granted Shaitaan's request.
Shaitaan came down to earth and caused the destruction of all Prophet Ayyub (AS)'s animals and property and worse of all, he killed his children as well. However, Prophet Ayyub (AS) turned to Allah with even greater intensity than before.
When Shaitaan saw his plot defeated, he caused Prophet Ayyub (AS) to lose his health and begot with a severe disease. Seeing the troubles befalling Prophet Ayyub (AS), his people began saying that he must had done something awful to incur the punishment of Allah and they began to avoid him. Finally he was exiled from his community and had to leave the town.
Prophet Ayyub (AS) began to live in the wilderness and passed his time praying to Allah. His only companion was his wife Rahma, who supported them by doing odd-jobs in people's houses. Several years passed and Shaitaan watched helplessly as Prophet Ayyub (AS) remained steadfast in his devotion and prayers to Allah. Finally, he decided that he would try Prophet Ayyub (AS)'s patience through his wife.
One day Shaitaan came in the form of a human being to Rahma and told her that he knew of a way to cure her husband of his terrible disease. He told her to take a sheep and slaughter it in his name instead of the Name of Allah. He claimed that its meat would immediately cure Prophet Ayyub (AS).
When she came back and suggested this treatment to her husband, he instantly realized what had happened. He said to her, "Has the enemy of my Lord misled you? Pity on you! How many years did we enjoy a life of happiness due to the Mercy of Allah?" She replied, "Eighty years." He said, "And how long have we been under this trial?" She said, "For seven years." Then Prophet Ayyub (AS) told her angrily, "Why should we not bear all this for the same period of time as we lived happily? By God! If I am relieved of my afflictions I will flog you with a hundred lashes for your evil suggestion." He then told her to go away and leave him alone.
Finally, Prophet Ayyub (AS) turned to Allah and complained about Shaitaan's repeated efforts to make him forsake his beliefs. The Holy Qur'an says: (Remember) Ayyub when he called to his Lord, "I am afflicted with distress and You are the Most Compassionate of all." So We heard his cry and relieved him of the misery he was in. (Qur'an 21:83-84)
Allah accepted the prayers of Prophet Ayyub (AS) and cured him of all his troubles. The Holy Qur'an says: (And We said to him) "Stamp your foot on the ground. This stream is for you to wash with, (and) a cool and (refreshing) drink." And we gave him his family and more like them; a mercy from Us and a reminder for those with understanding. And it was said to him, "Take in your hand a bunch of (thin) sticks (like fibre) and strike (your wife) with it, so as not to break your oath ." Verily, We found him steadfast, an excellent servant. Verily, he turned to Us often. (Qur'an 38:42-44)
Prophet Ayyub (AS) struck the ground with his foot and a stream of water came out. When he washed himself with the water he saw that his sickness disappeared and he returned to normal. His wife Rahma was worried about him, but when she returned she was amazed to see him restored to his former health.
Prophet Ayyub (AS) was happy at seeing his wife but after a time, he remembered his vow to punish her. But Allah revealed to him that he should strike her with a soft lash so as to literally fulfill his vow, but not to hurt her at all because she had faithfully served him in his time of trial. Allah then restored Prophet Ayyub (AS) to his former prosperity. He was blessed with many children and more followers than he had before.
There is a great lesson for us in the proverbial patience of Prophet Ayyub (AS). He suffered his hardship without bitterness, and submitted himself to the will of Allah, Who rewards plentifully those who remain steadfast in seeking His pleasure.