Praise be to Allah.
This question was put to Shaykh Muhammad ibn ‘Uthaymeen (may Allaah have mercy on him) and he said:
The scholars say that if a person does Hajj for worldly purposes and to make money, this is haraam. It is not permissible for him to have any worldly gains when doing an action that is for the Hereafter, because Allaah says (interpretation of the meaning):
“Whosoever desires the life of the world and its glitter, to them We shall pay in full (the wages of) their deeds therein, and they will have no diminution therein.
They are those for whom there is nothing in the Hereafter but Fire, and vain are the deeds they did therein. And of no effect is that which they used to do”
Shaykh al-Islam Ibn Taymiyah said: Whoever does Hajj in order to make money will have no share in the Hereafter, but if he takes money in order to do Hajj or help him do Hajj, there is nothing wrong with that and there is no sin on him.
Hence one must avoid taking money for the former purpose, because there is the fear that his Hajj will not be accepted from him and that the Hajj of the person on whose behalf he is doing it will not be valid either. In that case he has to return the money to the person who gave it to him, because we say that his own Hajj is not valid and the Hajj of the person who delegated him to perform Hajj on his behalf is also not valid.
But a person may take money as a means to enable him to perform Hajj on behalf of another, and he should make his intention to do what the one who paid the money wants him to do, and to draw closer to Allaah by worshipping Him through the rituals of Hajj and at the House of Allaah.