When we first see R2D2 (in The Phantom Menace), he is one of several robots aboard Queen Amidala's space cruiser fleeing Naboo for Tatooine. He clearly belongs to Padme.
In 32 BBY, R2-D2 was in the possession of the Royal Engineers of Naboo, and was assigned aboard Queen Amidala's Royal Starship as a maintenance droid. The Royal Engineers were famous for making after-market additions to their R2 units, which rendered the droids some of the most sought-after units in the galaxy.
In The Phantom Menace, Queen Amidala owns R2-D2, as the astromech is on her ship. C-3PO was built by Anakin Skywalker, but he built the droid for his mother, Shmi Skywalker, and he leaves the protocol droid in her care when he leaves Tatooine. In The Attack of the Clones, Queen Amidala still owns R2-D2.
After C-3PO and R2-D2 landed on Tatooine, Jawas picked up the two droids, fitting them with restraining bolts. The Jawas sold the robots to Owen and Beru Lars and their nephew Luke Skywalker, a seemingly minor event that would change the fate of trillions in the galaxy.
Beginning his service in the employ of Queen Amidala of Naboo, R2-D2 wound up serving Jedi Knight Anakin Skywalker during the waning years of the Galactic Republic, often accompanied by the protocol droid C-3PO in many adventures throughout the Clone Wars.
As such, by the time of Anakin and Padme's marriage, Anakin was the owner of C3PO and Padme the owner of R2D2 (or the state of Naboo).
R2-D2 was built in 33 BBY on Naboo and belonged to Padmé Amidala. The following year, he became the property of Anakin Skywalker, who he had a trustful friendship with. R2 served in several missions during the Clone Wars, alongside his owner.
Watto was a Toydarian junk dealer in Mos Espa who bought Shmi Skywalker and her son Anakin from Gardulla the Hutt. An inveterate gambler, he sponsored Anakin in several Podraces, but often bet against his own slave, who was talented but inexperienced.
Padme gives her droid R2-D2 as a gift, and new co-pilot for Anakin.
R2-D2, from Return of the Jedi | National Museum of American History.
History. Anakin Skywalker, a Tatooine slave boy, was gifted in engineering -- and was strong with the Force. To help his mother, Shmi, he secretly built a droid: C-3PO. In his earliest form, Threepio had no outside covering, and so appeared “naked,” with his internal parts and motors showing.
Built by Anakin Skywalker, C-3PO was designed as a protocol droid intended to assist in etiquette, customs, and translation, boasting that he is "fluent in over six million forms of communication".
Following the Trade Federation's invasion of the Mid Rim planet of Naboo, C-3PO's life entered a new chapter when his owner Anakin met several off-worlders at the shop of his owner, the Junk dealer Watto, and then invited them to seek shelter at his home during a sandstorm.
We see how both droids are put into an escape pod, crash on Tattooine, are captured by the Jawas, and were then bought by Owen Lars, who was Anakin Skywalker's stepbrother and Luke's uncle. So that's how C-3PO came to be Luke's droid. Anakin built him.
Obi-Wan Kenobi Is R2-D2's Friend, Not His Owner.
Anakin discovered that a moisture farmer named Cliegg Lars had bought Shmi from Watto, freed her, and married her. But when he visited the Lars farm, he learned Tusken Raiders had kidnapped his mother. Anakin found Shmi, but she died in his arms. Giving in to his rage, he slaughtered the Tuskens who had taken her.
A wily crime lord and member of the shadowy Hutt Council, Gardulla was the original owner of Shmi and Anakin Skywalker, but lost them betting with the junk dealer Watto. She watched her former slave's victory in the Boonta Eve Classic alongside Jabba.
In The Phantom Menace, when Qui-Gon Jinn meets tiny Anakin Skywalker and his mother, he goes on about how the Force is like, crazy strong with Anakin or whatever, and then asks his mother about Anakin's dad. Shmi Skywalker is pretty clear in her answer: There isn't a father. She was impregnated by the Force.
Further in Empire Strikes Back, neither Yoda nor Darth Vader recognizes either droid. Luke travels with R2-D2 to the Dagobah where they find Yoda. Yoda's relationship with R2-D2 is not on the same level with the same characters. Perhaps, the old creature simply forgot.
“Carefully moving through the swamp while staying beneath the fog, Yoda soon spotted the boy and his droid unpacking their supplies. Even though the droid was caked with algae, dirt, and stomach fluid, its appearance and familiar blips were still quite recognizable. R2-D2.
He didn't recognize him because again, they all look the same & it was decades until he saw him again. There was no reason to believe he or R2 even existed anymore. Do R2D2 and C3PO know that Darth Vader is Anakin? Threepio had his memory wiped at the end of Revenge of the Sith.
During the Clone Wars, it was common practice to wipe the minds of astromech droids after every mission to avoid the risk of Separatists taking valued information. But Anakin remained staunchly against this idea for R2-D2, meaning the droid never had to worry about losing the memories of his past.
R2-D2 unit from 'Star Wars' sells for $2.75 million | CNN.
Amazon.com: Star Wars The Black Series R2-D2 Figure : Toys & Games.