WASHINGTON—President Donald Trump indicated Tuesday he wanted to see Republican Alabama Senate candidate Roy Moore elected despite allegations of sexual misconduct, citing the significance of maintaining the GOP’s slender majority in the chamber.

“We don’t need a liberal person in there, a Democrat,” Mr. Trump said, referring to Mr. Moore’s opponent, Doug Jones. Mr. Trump said of Mr. Jones: “I’ve looked at his record, it’s terrible on crime, it’s terrible on the border, it’s terrible on the military.”

Mr. Jones is a former U.S. Attorney who successfully prosecuted two Ku Klux Klan members for the bombing of a Birmingham church that killed four girls.

Mr. Trump didn’t rule out campaigning for Mr. Moore, saying, “I’ll be letting you know next week.” In his comments, he didn’t directly say he supported the candidate.

Mr. Trump’s comments were the strongest support he had shown to date for Mr. Moore in the wake of allegations of sexual misconduct from several decades ago. Republicans have been divided over how to handle the accusations against their candidate in the Alabama special election to fill the seat vacated by Attorney General Jeff Sessions. If Mr. Moore loses, the GOP majority would narrow to just one seat, further limiting the party’s ability to pass major legislation.