It is not illegal for an employee to be off sick from one job and receive sick pay, whilst continuing to work for another employer. Many employers incorrectly refer to this as the employee 'defrauding' the company and even take disciplinary action, up to and including dismissal.
However, the legal position is that as long as the employee is genuinely certified unfit to work and this affects their ability to carry out the specific job from which they are signed off, they are able to be off sick from it. In the meantime if they are capable of performing another job, which is not affected by the reasons for being signed off sick, they can do so. For example, someone is signed off sick due to workplace stress as a result of heavy workload or bullying by colleagues. The stress prevents them from working in that specific job as the stressors are directly connected to it. It does not prevent them from continuing to work in another, less stressful job, where no stressors are present.
It is also important to consider the conditions of the employment contract or relevant policies from the job the employee is signed off from. For example, the employee's contract could state that a condition of receiving company sick pay is that they do not work elsewhere, or they could even be a blanket prohibition on having a second job. In such circumstances it would be a potential breach of contract to have the second job, even if generally it would not be illegal to do so.
In the absence of such a restriction and assuming the reasons for being signed off sick are genuine and do not affect you working in the second job, this would not be illegal.