The Australian goalkeeper spent a loan spell with Belgian side KRC Genk towards the end of the 2016-17 campaign and will join the newly-promoted Premier League side in July, subject to international clearance.
Speaking about the deal, Albion manager Chris Hughton told the club's official website: "I'm delighted that we've been able to attract Mathew to the club, and he will certainly be an excellent addition to the squad in time for our first season in the Premier League.
"We're very much looking forward to working with him for the season ahead. For somebody of Mathew's age, he has very good experience, having played in the top divisions in Australia, Belgium and Spain.
"He has also competed in European competition and made a number of appearances at international level."
Ryan only made 10 La Liga appearances over two seasons for Valencia before his move to KRC Genk, where he kept 11 clean sheets in 24 games for the club.
The 25-year-old is currently with the Australia squad at the Confederations Cup, with the Socceroos' first game of the tournament coming against Germany on Monday.