The 24-year-old, whose contract expired at the end of last season, looked destined to leave the club after spending much of the summer training with Birmingham.
Posh boss Darren Ferguson told the club's official website: "Mark is a very good signing for us.
"He did well for us in the Championship, his contract expired and we have given him a new one. We couldn't agree in the summer, he was fully entitled to talk to other clubs and now we have got it all sorted.
"I am delighted he is back. Mark and Craig Alcock are probably two of the best right-backs in this league, they are right up there, so I have good competition. We want to get young Michael Richens out on loan and we will work on that.
"You want two players for every position as a manager and I believe we have two very good right-backs at this club now."