Yes, the wife has to do Hajj with this money whenever she is able to and has a mahram, because the husband only gave her the money to do Hajj with it. It seems that if he knew that she would not do Hajj with the money he would not have given it to her. The basic principle with regard to donated money is that it should be spent on the charitable causes stipulated by the giver, and it should not be spent on anything else, unlike general donations which are not intended for any specific purpose, so they may be spent on all kinds of charitable causes.
Shaykh Zakariya al-Ansaari (may Allah have mercy on him) said:
If he gives him some money and tells him: Buy yourself a turban with it or use it to go to the public bath (hammam) and so on, then it is specifically for that purpose, because that was the intention of the one who gave the money, as he intended that he should cover his head with the turban and clean himself by going to the hammam, because he saw that he was bareheaded and that his body was unkempt and dirty. Otherwise, if he did not intend that exactly, such as if he said it by way of ordinary chitchat, then he does not have to use the money for that particular purpose, rather he may take possession of it and dispose of it in whatever way he wants.
End quote. Asna’l-Mataalib Sharh Rawdat al-Taalib, 2/479-480
Shaykh Sulaymaan ibn ‘Umar al-Jamal (may Allah have mercy on him) said:
If he gives him dates with which to break the fast, then he must use them for that purpose, and it is not permissible to use them for any other purpose, because the intention of the giver was specific. End quote.
Haashiyat al-Jamal ‘ala Sharh al-Manhaj, 2/328
And Allah knows best.