The German government said Tuesday it would allow Syrian refugees to stay in the country regardless of where they first entered the European Union, the latest indication of how difficult it has become to enforce the bloc’s asylum rules.

Under EU rules, refugees have to request asylum in the country where they first enter the union, putting states with large external borders, such as Italy, Greece or Hungary, on the front line. Refugees who make their way to other EU states, often hoping for better treatment and facilities...