Turkey released an American pastor it detained for two years and sent him home, a development that could help ease tensions with Washington as Ankara seeks U.S. support to avoid a direct confrontation with Saudi Arabia over a journalist’s disappearance.

A Turkish court found the pastor, Andrew Brunson, guilty of aiding terror groups on Friday and sentenced him to more than three years in prison, but freed him because of time already served. Mr. Brunson denied the charges.

The...