All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
It is not permissible to stipulate a fine for the delay in repayment of debts, because that is forbidden Riba (interest and/or usury).
One is not permitted to enter into a contract that includes such a condition even if he intends to avoid the delay.
Paying fees in return for a given benefit falls under “debts”, because this entails a financial liability one owes just like all other debts.
Membership in the gym takes the ruling of a hiring contract, so the fee for that is a debt owed by the participant. Therefore, imposing a fine if the monthly membership payment is delayed is considered Riba. Thus, it is neither permissible to impose it nor to enter into the contract as long as it includes this condition.
Allah knows best.