The German government has agreed to new legislation that will force companies to comply with social and environmental rules along their global supply chains.