Praise be to Allah.
The reality of membership of a gym or health club is that it is a rental contract for use of the facilities.
In the case of a rental contract, it is permissible for the renter to make use of the facilities himself or allow someone else to do so.
Al-Bahooti (may Allah have mercy on him) said:
The renter may make use of the facilities himself or allow someone else to do so, by lending or otherwise, because he has access to the facilities by virtue of the contract. So he may make use of them himself, or allow someone else to do so.
End quote from Kashshaaf al-Qinaa‘ (4/16)
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
It is permissible for the renter to rent out the rented item to someone who takes his place, in return for a similar rent or more. End quote.
But if the owner has stipulated that only the renter may make use of the rented item or facility, and that such use is not transferable, then in this case he must abide by this condition.
It says in Fataawa al-Lajnah ad-Daa’imah (vol. 1, 15/88):
If a person rents something, he may rent it out in turn to another person, for the same amount as he rented it, or for more or less than that, and for the same time period as agreed upon, to someone who will make use of it as he would, or less than that, but not more than that, so as to avoid harm, because he has the right to make use of the rented item, so it is permissible for him to make use of it himself or allow another person to do so.
That is unless the owner has stipulated that he should not rent it out to others or that he should not rent it out to people who practice specific professions or crafts, in which case both parties are bound by the conditions they have stipulated. End quote.
See: al-Ikhtiyaaraat al-Fiqhiyyah by Shaykh al-Islam (152); ash-Sharh al-Mumti‘ (10/71) by Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him).
Based on that, if the membership of the gym is a personal membership and it is not allowed for anyone other than the cardholder to go to this gym and make use of the facilities, then you must abide by this condition, and it is not permissible in this case for you to use this membership card.
The Prophet (blessings and peace of Allah be upon him) said: “The Muslims are bound by their conditions.”
What has been said regarding gym membership cards may also be said concerning tickets. If it is stipulated that the ticket may only be used by the purchaser, it is not permissible for him to give it to someone else to use it.
If no such condition has been stipulated, it is permissible for him to use it himself or let someone else use it.
And Allah knows best.