This Surah was revealed in Makkah at the same time when the Prophet (ﷺ) and his companions were shown so much hatred and hostility, that some of them fled to Ethiopia. It was in such a situation that this Surah was revealed, to teach the Prophet (peace be upon him) and his companions to be patient, this is how the religion was inherited. Allah Ta'ala also created life as a whole to test mankind and see who will stand up and do his best.