It may an act of veneration and drawing closer to the one to whom one prostrates. This kind of prostration is worship, and should only be done for Allaah, according to the laws of the Prophets.
The second type is a kind of greeting and honouring a person. This is the kind of prostration which Allaah commanded the angels to do in the case of Adam, so they prostrated to him as an act of honouring him. It was an act of worship towards Allaah on their part, because they were obeying His command to prostrate to Adam.
The prostration of Yoosuf’s parents and brothers was also a prostration of greeting and honouring, which was permissible according to the law (of Allaah) at that time. But according to the sharee’ah brought by the Seal of the Prophets, Muhammad (peace and blessings of Allaah be upon him), it is not permissible to prostrate to anyone at all except Allaah. Hence the Prophet (peace and blessings of Allaah be upon him) said: “If I were to have commanded anyone to prostrate to anyone else, I would have commanded women to prostrate to their husbands.” The Prophet (peace and blessings of Allaah be upon him) forbade Mu’aadh to prostrate to him when he (Mu’aadh) said that the People of the Book prostrated to the great ones among them, and he mentioned the hadeeth quoted above. The prohibition in this sharee’ah against prostrating to anyone at all except Allaah is an aspect of its perfection in achieving true Tawheed. It is the perfect sharee’ah whose perfection is manifested in all its rulings. Allaah says (interpretation of the meaning):
“This day, I have perfected your religion for you, completed My Favour upon you, and have chosen for you Islam as your religion” [al-Maa’idah 5:3]