Majority of scholars say that this verse was revealed in Makkah (Zamakhshari, Imam Razi, Qadi, Baidawi, Nizam ad-Din Nisaburi and Ibn Kathir). However, later scholars say that the verse was revealed in Madinah (Mawdudi). 
“And they give food in spite of love for it to the needy, the orphan, and the captive” – Quran 76:8
76:8 – The true believers race towards gaining good deeds by feeding the needy, the orphans and the captives. The captive here refers to those who were rightfully captured at the battle of Badr (Tafsir Ibn Kathir). When one side becomes victor in war, there is always going to be on the enemy side those who will surrender.
Out of kindness and love the believers feed the captives. They were commanded to treat these prisoners with kindness and respect. Vast majority of those captured were released shortly after the war lay down and ceased.
Dr. Muhammad Asad:
“9 I.e., the spiritual and social obligations arising from their faith.
10 Or, as in 2:176, “however much they themselves may cherish [i.e., “need”] it”; cf. also 90:14-16. It is to be noted that in this context the concept of “giving food” comprises every kind of help and care, both material and moral.
11 The term asir denotes anyone who is a “captive” either literally (e.g. a prisoner) or figuratively, i.e., a captive of circumstances which render him helpless; thus, the Prophet said,
“Thy debtor is thy captive; be, therefore, truly kind to thy captive” (Zamakhshari, Razi, et al.). The injunction of kindness towards all who are in need of help – and therefore “captive” in one sense or another – applies to believers and non-believers alike (Tabari, Zamakhshari), and apparently also to animals dependent on man.” 
Scholar Abdullah Yusuf Ali:
“5839 The captive: when taken literally, it refers to the OLD STATE of things when captives of war had to earn their own food, or their own redemption; even ordinary prisoners in jail for criminal offences often starved unless food was provided for them by private friends or from their own earnings.
But there is a further symbolic meaning, which applies to the indigent, the orphans, and the captives, viz. those who are so in a spiritual sense: those have no mental or moral resources, or have no one to look after them, or are held down in social or moral or economic captivity.
They hunger for spiritual food, or perhaps their appetite is deadened, but the Righteous understand and supply their real needs. It has also been held that ‘captives’ include dumb animals who are under subjection to man; they must be properly fed, housed, and looked after; and the righteous man does not forget them.” 
Sayyid Abul Ala Maududi:
“11Most of the commentators hold the view that the pronoun in hubbi-hi refers to food. Accordingly, they interpret the sentence to mean: “In spite of the food’s being agreeable and tasty and that they need it, they give it away to others.”
Ibn `Abbas and Mujahid say: “they do so because of their fondness for feeding the poor ( `ala hubb-il-it am); and Fudail bin `Iyad and Abu Suleman ad-Darani say: “They do so out of love for Allah.” In our opinion the following sentence (“We are feeding you only for the sake of Allah”) supports the last meaning.
12 The custom in the ancient days was that the prisoners were put in fetters and shackles and taken out daily to go about the streets begging food. Later the Islamic government abolished this custom. (Imam Abu Yusuf, Kitab al-Kharaj, p, 150, Ed, 1382 H. )
In this verse, the captive implies every such person who is in bondage, whether he is an unbeliever, a Muslim, a war prisoner, or imprisoned in consequence of a crime, and whether he is provided food in that state, or made to beg for it. In any case, to feed a helpless person who cannot do anything to earn a living, is an act of great virtue.
13 Although feeding a poor man is in itself a great virtue, yet fulfilling the other needs of an indigent person is no less virtuous. For example, to clothe a poor man, to arrange treatment for a sick person, or to help a debtor who is harassed by his creditor, is an act of equally great virtue. Here, a particular kind of virtue in view of its importance has been presented only as an example, but the real object is to stress giving help to the needy.” 
Malik Ghulam Farid:
“3194. The verse may mean,
(1) because the righteous believers love God, so in order to win His pleasure they feed the poor and the captives.
(2) They feed the poor for the sake of feeding them, i.e., they do the good act of feeding the poor for the sake of doing good, seeking no reward, appreciation or approbation for what they do.
(3) They feed the poor while they themselves love the money which they spend on them.
(4) They feed the poor with wholesome and agreeable food, ‘Ta’am’ meaning agreeable and wholesome food (Lane).” 
Tafsir Ibn Kathir (1301 – 1373 AD):
“(And they give food, inspite of their love for it, to the poor, the orphan and the captive,) Concerning the poor person and the orphan, an explanation of them and their characteristics has already preceded. In reference to the captive, Sa`id bin Jubayr, Al-Hasan and Ad-Dahhak all said,
“He is the captive among the people of the Qiblah (i.e., the Muslims).” Ibn Abbas said, “At that time (when this Ayah was revealed) their (the Muslims’) captives were idolaters.” Proof for this is that on the day of Badr the Messenger of Allah commanded his Companions to treat the captives respectfully.
They (the Companions) would give them preference over themselves when eating their meals. `Ikrimah said, “They (captives) are the slaves.” Ibn Jarir preferred this opinion since the Ayah generally refers to both the Muslim and the idolators. Sa`id bin Jubayr, `Ata’, Al-Hasan and Qatadah all made similar statements.
The Messenger of Allah advised treating servants well in more than one Hadith. This held such importance with him that the last statement of advice that he gave (before dying) was his saying…” (Tafsir Ibn Kathir on Surah 76:8 – Online Source)
Asbab Al-Nuzul by Al-Wahidi (d. 1075 AD):
“And feed with food the needy wretch, the orphan and the prisoner, for love of Him) [76:8]. ‘Ata’ reported that Ibn ‘Abbas said: “It happened that ‘Ali ibn Abi Talib hired himself one night to water some palm-trees in exchange for some barley. The following morning, he collected his barley and grinded a third of it out of which they made something to eat, called al-Khazirah.
When it was cooked, a poor man came begging from them, and so they gave him the food they had prepared. They then prepared a third of the remaining barley and when it was cooked, an orphan came begging from them, and they gave him the food.
They then went and prepared what was left of that barley, but when the food was cooked, a prisoner from among the idolaters came to them and they fed him that food and spent the rest of the day without eating anything. This verse was revealed about this incident”. (Asbab Al-Nuzul by Al-Wahidi on Surah 76:8 – Online Source)
Tafsir al-Jalalayn (15/16th century commentary):
“And they give food, despite [their] love of it, that is to say, [despite their love] of food and their craving for it, to the needy, the poor, and the orphan, who does not have a father, and the prisoner, meaning the one who has been rightly imprisoned.” (Tafsir al-Jalalayn on Surah 76:8 – Online Source)
Tanwir al-Miqbas min Tafsir Ibn Abbas (d. 1414 AD):
“And feed with food the needy wretch, the orphan) among the Muslims (and the prisoner) and the Muslim prisoner in the captivity of the idolaters; and it is also said: any kind of prisoner, (for love of Him) despite their desire for food and its scarcity…” (Tanwir al-Miqbas min Tafsir Ibn ‘Abbas on Surah 76:8 – Online Source)
 Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an:
“but vv. 8-10 of it were sent down at Madinah.” http://www.englishtafsir.com/Quran/76/
 The Message of The Quran translated and explained by Muhammad Asad, page 1235
 Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an
 The Holy Qur’an – Arabic Text With English Translation & Short Commentary By Malik Ghulam Farid, Page 1209
 The Meaning Of the Glorious Qur’an: Text, Translation, and Commentary by Abdullah Yusuf Ali, page 429