Is it illegal to machine medical machines for a third party

Not illegal.

It is legal in the case of having registered documents, the processing party needs to have a formal business license and business qualifications, all the formalities are prepared, are perfect, there is no violation of the law.

Medical devices are instruments, equipment, apparatus, in vitro diagnostic reagents and calibrators, materials and other similar or related items used directly or indirectly in the human body.