Magnetism of a system interacting with a common environment