The 21-year-old scored twice for the non-league team in their FA Cup first-round defeat by Carlisle in November.
Morais has previously played in the Football League for Wycombe.
"He has scored some great goals already this season for St Albans, and we are pleased to have secured his signature," said Posh boss Grant McCann.
Media playback is not supported on this device
Peterborough United have signed striker Junior Morias from National League South side St Albans for an undisclosed fee on a two-and-a-half year deal.