Whenever you have finished your duties, devote yourself to Allah’s worship by prayers, Thikr (remembering of Allah) and supplication.
Prayer was not obligatory till the trip of Isra’ and Mi’raj at the end of the Makki period before migration to Madinah. Allah (swt) has committed the Messenger (saws) the mission of publishing the message to his clan, people of Makkah and to the whole world.
To reveal this message the Prophet (saws) has endured a lot of hardships that occupied him from the worship he used to practice in the cave of Hira’ – where Jibril came down to him with the revelation – so he became busy with people, in trouble and hardship, so, he was busy with people and in hardship.
The verse means: When you have finished from all these hardships, then stand and devote yourself to Allah’s worship. The Prophet (saws) was praying at night and his feet had swelled up.
Aa’isha (may Allah be pleased with her) asked him; “Do you pray while Allah has forgiven your past and future mistakes?” So, he said:
“Oh Aa’isha, should I not be a thankful slave?”
It does not mean to exhaust himself, rather, to direct his desires and intentions to Allah (swt) to approach Him as a lover, and to persist in supplication.
 Sahih Al-Bukhari, Book of Tafsir, Hadith No. 4557.