Adoption is a process whereby a person assumes the parenting of another, usually a child, from that person's biological or legal parent or parents. Legal adoptions permanently transfers all rights and responsibilities, along with filiation, from the biological parent or parents.
The reply depends on what you mean by adoption. If you mean looking after and bringing up a child, then it is great deed of reward. The Hadeeth says: Best of the homes is a home where an orphan lives with honor. Also it is narrated from the Prophet Muhammad (SAWA): I and orphan sponsor are in the Paradise together.
But if you mean to look after the child and deprive him from the name of his real father , mother and original family, then it is unlawful in Islam to deprive the child from the name of his father, mother and original family.
Allah says in Quran (Call them by their fathers' name)(ادعوهم لابائهم)Al-Ahzaab,5.
Also it is not allowed to deprive the child from his real mother (إن أمهاتهم إلا اللائي ولدنهم )(Their mothers really are who gave birth to them) Al-Mujadalah ;2.
Claiming the adopted child as a real son or daughter is forbidden in Quran (وما جعل أدعياءكم أبناءكم ذلك قولكم بأفواهكم ) (Allah did not make your sponsored/ adopted/ fostered children as your children, that is what you say in your mouths).
So, it is very good to adopt a needy child with keeping his father's, mother's and family name with him always.
Yes, Muhammad son of Abu Bakr was from a pious lady (Asmaa' Bint Omais) who was widow of Jafar Ibn Abi Talib (AS) who was martyred in the battle of Mo'ta and is caled then Jafar Al-Tayyar. Abu Bakr proposed to that lady during his government and she could not refuse the ruler. She had from that marriage a son called Muhammad. After the death of Ab Bakr, Imam Ali (AS) proposed t this lady to look after the orphans of his brother Jafar. Muhammad Inb Ab Bakr was looked after and brought up by Imam Ali (AS) and became a very good Momin. He was with Imam Ali in fighting his enemies including fighting in the battle of jamal (Camel) led by his own step sister Aaysha daughter of Abu Bakr. Imam Ali (AS) asked Muhammad Bin Abu Bakr to accompany Aaysha from Basra back to Madina.
Some quick information about Muhammad ibn Abi Bakr:
1. Name: Muhammad
2. Father's name: Abu Bakr ibn Abdullah ibn Abi Qahafah [the first Caliph].
3. Mother's name: Asma' bint 'Umays, who was married to Ja'far ibn Abi Talib [Ja'far al-Tayyar] (a.s.), and after his martyrdom she married Abu Bakr. She gave birth to Muhammad while in the state of Ihram. After Abu Bakr's death, Asma' married Imam Ali (a.s.). Throughout her life she stayed loyal to Ahlul bayt (a.s.).
4. His birth: Year of Hajjatul-Wada'.
5. His death: 38 AH. Martyred in Egypt at the hands of Mu'awiyah.
6. He openly opposed the Khilafah of his father Abu Bakr, and from those early years he pledged allegiance to Imam Ali (a.s.).
7. He was nurtured by Imam Ali (a.s.), who treated him as his own son. He participated in the Battles of Jamal and Siffin. In the Battle of Jamal he confronted his sister 'Aishah.
8. Imam Ali (a.s.) appointed him as governer of Egypt.
9. He was martyred in a tragic way, by command of Mu'awiyah. It is mentioned in numerous sources that Mu'awiyah ordered his blessed body to be burned. See following link that mentions Sunni references for this: