BERLIN—Germany flew 34 rejected Afghan asylum applicants to Kabul overnight despite protests from human-rights groups, a signal of a new hard line by Chancellor Angela Merkel’s government as it scrambles to address public discontent over migration with an election year looming.

The flight, announced by Interior Minister Thomas de Maizière on Thursday morning, marked the first time that Germany has deported a large group of migrants to the country still riven by a Taliban insurgency. While only about half of asylum applicants...