CAIRO — President Abdel Fattah el-Sisi on Monday enacted a law that imposes strict new regulations on aid groups, stoking fears that his government intends to accelerate its harsh crackdown on human rights activists before a presidential election scheduled for next year.

The new law, which some aid groups predict will force them to shut down, was approved by Egypt’s Parliament in November, but Mr. Sisi hesitated to sign it after trenchant criticism from Western officials, most notably the Republican Senators John McCain of Arizona and Lindsey Graham of South Carolina, who threatened to restrict American aid to Egypt if the legislation was approved.

But recently Mr. Sisi has appeared emboldened by a burgeoning friendship with President Trump, who has hailed the Egyptian strongman as a “fantastic guy” and indicated that he did not intend to allow human rights issues to sour their relationship.

Having welcomed Mr. Sisi to Washington last month, Mr. Trump met with him again during his visit last week to Saudi Arabia, where the two leaders were photographed touching a glowing orb alongside Salman, the Saudi king. On his return to Egypt, the Sisi government pushed through new news media restrictions and prosecuted a rival political leader in the courts, further squeezing political rights and free speech.