Social media companies in Germany face fines of up to 50m euros ($57.1; £43.9m) if they fail to remove "obviously illegal" content in time, as stated by BBC.
From October, Facebook, YouTube, and other sites with more that two million users in Germany must take down posts containing hate speech or other criminal material within 24 hours.
Content that is not obviously unlawful must be assessed within seven days.
The new law is one of the toughest of its kind in the world.
Failure to comply will result in a 5m euro penalty, which could rise to 50m euros depending on the severity of the offence.
In a statement, Facebook said it shared the goal of the German government to fight hate speech.