There are two versions of Varah Avatar, one is in Vishnu Purana (Part I. Chapter 4), and other in Srimad Bhagavata (Part III, Chapter 13). They differ in details.
The account in Sri Vishnu Purana was provided by Sage Parasara in reply to a query by his pupil Maitreya.
The context in Vishnu Purana is creation at the beginning of the present Sweta Varaha Kalpa.
As per the account in Vishnu Purana, Narayana woke up from His deep sleep at the end of the previous Kalpa called Padma Kalpa. He surveyed His surroundings and He found that there was only water, water everywhere, the earth being visible nowhere. The earth was swallowed up by the swirling waters around it.
Narayana then saw a lone lotus leaf floating in the water indicating that its support, the earth, was beneath it.
To retrieve earth and restore it to its former position, Bhagavan Srihari Vishnu took the form of a boar, which is suitable for diving fearlessly into the slushy and slimy waters of the ocean.