The 25-year-old spent 2020-2021 on loan with the Primeira Liga club, making 39 appearances in all competitions.
That was Grujic's latest spell away from Liverpool, whom he joined from Red Star Belgrade in 2016, having also previously spent half a season with Cardiff City and two years at Hertha Berlin.
He was the first signing of the Jurgen Klopp era at Anfield but featured just 16 times for the Reds in all competitions.
Serbia international Grujic linked up with the Liverpool squad for this month's pre-season training camp in Austria, but the Merseyside outfit confirmed on Tuesday that he has officially ended his five-year association with the club.
"Everyone at Liverpool FC thanks Marko for his contributions to the club and wishes him the best in his future career," the 2019-20 Premier League champions said in a statement.
Porto is reported to have paid an initial €12.15million (£10.5m) for Grujic, who was also rumoured to be a target for fellow Portuguese side Sporting CP and Italian club Sassuolo.
Grujic scored twice as Porto finished second to Sporting in the Primeira Liga last season and featured eight times in Sergio Conceicao's side's run to the Champions League quarter-finals.
The 6.94 aerial duels Grujic won per 90 minutes in the Portuguese top flight last season was behind only Pedro Henrique (7.94) and Rio Ave's Ronan (8.62) among those to have featured more than three times in the competition.
Grujic also won more tackles per 90 minutes than any other Porto player who started six or more games in the league last season, the Serbian's tally of 1.32 putting him slightly ahead of Otavio (1.31).