John Locke explained his theory of property in the Second Treatise
(primarily chapter 5).
What is property? Property is basically a claim to ownership of
something. Locke divided property into two types, common and private.
I'm assuming you are asking about private property for the remaineder
of the questions.
How do we get it? Locke's theory of private property is a labor theory
of property that builds from a common property basis. He believed that
God gave the world and all that was in it to man for his common use.
Private property emerged for convenience sake.
Chapter 5, Sec. 26. "God, who hath given the world to men in common,
hath also given them reason to make use of it to the best advantage of
life, and convenience."
Locke used a labor theory to make the bridge from common to private
property. Man is able to call property "private" meaning man has
exclusive use and disposal rights, by using his labor.
Chapter 5 Sec. 27. "Though the earth, and all inferior creatures, be
common to all men, yet every man has a property in his own person:
this no body has any right to but himself. The labour of his body, and
the work of his hands, we may say, are properly his. Whatsoever then
he removes out of the state that nature hath provided, and left it in,
he hath mixed his labour with, and joined to it something that is his
own, and thereby makes it his property. It being by him removed from
the common state nature hath placed it in, it hath by this labour
something annexed to it, that excludes the common right of other men:
for this labour being the unquestionable property of the labourer, no
man but he can have a right to what that is once joined to, at least
where there is enough, and as good, left in common for others.
How do we keep it? You get to keep the fruits of your labor as long
as you follow the basic rules, you do not waste anything, i.e. and
there is enough left in common for others. (the last phrase of the
above quote). Quick and dirty interpretation, no wasting or hording.
How would we lose it? You would lose the fruits of your labor if you
went against the above two clauses, waste and leaving enough for
others. so, for example, Locke believed that you could not go to the
apple orchard and pick all the apples for all the trees for yourself
because there would be no possible way for you to eat all the apples,
they would go to waste. You would also not leave enough for others.
However, there is a caveat. Locke believed you could go into the apple
buisness and gather more apples that you could possible eat and then
exchange them with others for goods and/or money.
Moral basis for our claim?
John Locke believed the moral basis for the claim was founded in
Natural Law Theory. As in the beginning of this answer, Locke was
among the natural law theorists who used "God" as the basis for his
theory of property. Hugo Grotius, a semi-contemporary of Locke and
sometimes referred to as the father of International Law, used a
similar type of reasoning in his theory of property. i.e., God gave
the earth to man in common.
Locke, theory of property
Locke, Second Treatise