READ: Series five of Doncaster sitcom Still Open All Hours is confirmedThirsk Community Primary School said the reception class pupils were "quickly located" after a search but an investigation has been launched, led by health and safety experts at North Yorkshire County Council.
The children, who will be four or five years old, would have had to cross the main A61 road in the town to get to the Norby area, where they were found.
In a message to parents, headteacher Richard Chandler said: "As you may already be aware, at the end of lunchtime on Friday, two boys in our reception class scaled a two-metre metal fence at the far corner of our school field and walked home to Norby.
"As the class lined up to go back into the school, the two boys were not accounted for.
READ: Doncaster TV star Jeremy Clarkson kicks off new Who Wants To Be A Millionaire series this weekend"An immediate search of the school and grounds was made and then the parents were called. The two boys were quickly located. They had arrived at their grandmother's house about a mile away."
Mr Chandler said: "The school takes its responsibilities for pupil safety very seriously."
He said that "several further measures have been implemented", supervision arrangements throughout the day have been reviewed, and all children have been spoken to about the importance of staying safe.
Mr Chandler added: "For the current time, reception children are to play during break times in their own enclosed area."