Praise be to Allah
If the sacrifice is offered to Allah, may He be exalted, and the intention behind that is to give some of this meat in charity to the poor and needy, then there is nothing wrong with that. It was narrated from the Messenger (blessings and peace of Allah be upon him) that he said: “Treat your sick by means of charity.” Narrated by Abu Dawood in al-Maraaseel. It was also narrated by at-Tabaraani, al-Bayhaqi and others, from a number of the Sahaabah. All its isnaads are da‘eef (weak) but it was classed as hasan by al-Albaani (may Allah have mercy on him) because of corroborating evidence in Saheeh at-Tirmidhi (744)
The scholars of the Standing Committee for issuing fatwas were asked:
Please explain to us the hadith “Treat your sick by means of charity” – narrated by al-Bayhaqi in as-Sunan al-Kubra (3/382) and classed as da‘eef by most of the hadith scholars – with regard to treating the sick by offering a sacrifice for him. Is that prescribed or not in order to relieve him of sickness?
They replied: the hadith mentioned is not saheeh, but there is nothing wrong with giving charity on behalf of the sick person for the purpose of drawing close to Allah and in the hope that Allah may heal him thereby, because of the general meaning of the evidence that points to the virtue of giving charity, and says that it extinguishes sins and wards off a bad death. End quote.
Fataawa al-Lajnah ad-Daa’imah (24/441)
Shaykh Ibn Jibreen (may Allah preserve him) said:
Charity is a useful and beneficial remedy that brings healing from disease and alleviates sickness. This is supported by the words of the Prophet (blessings and peace of Allah be upon him): “Charity extinguishes sin as water extinguishes fire.” Narrated by Ahmad (3/399). Perhaps some diseases happen as a punishment for a sin that the sick person committed, but when his family give charity on his behalf, this sin is erased and so is the cause of the sickness, or hasanaat (good deeds) are recorded for him because of the charity, so his heart is revived thereby, and the pain of the sickness is reduced as a result. End quote.
Al-Fataawa ash-Shar‘iyyah fi’l-Masaa’il at-Tibbiyyah (2/question no. 15)
There is nothing wrong with you offering a sacrifice for the sake of Allah, may He be exalted, intending it as charity on behalf of the sick person, in the hope that Allah may heal him and grant him well-being, especially if that is also done as the udhiyah too.
But there is no need to specify that a goat should be sacrificed, because the aim is to offer a sacrifice as an udhiyah and charity, so you may sacrifice whatever you can afford of whatever fulfils the conditions of udhiyah, whether it is a goat or anything else.
And Allah knows best.