To get an official handicap in the UK you must have a membership of a golf club or golf society that is recognised by the local golf authority. For example in Scotland it is the SGU Scottish Golf Union.
Golf societies can be associated with golf courses but dont necessarily require membership of a course.
Every course and golf societies have different rules regarding getting your handicap. This is partly down to interpretation of the rules.
Most rules require 3 signed cards completed under normal stroke play rules as stipulated by the R&A rules. So no gimmies or picking up on any holes. You need to record your true score for the round.
The person signing your card needs to have accompanied you round the course. They can either play with you or walk as a marker.
Some rules state that all three rounds need to be played from the white tees where as some others state that you need to pay 1 from the whites and the rest from either whites or yellows. On your card you need to mark which you played from.
Normally one of the three rounds needs to have been in competition where your status is playing for handicap. This is normally only possible to do
in the summer.
From your three scores the handicap sceretary then decides your handicap. Normally any scores over double bogey will get taken as double bogey when working out the handicap.
Handicap is based on how many over the course SS Standard Scratch you were. So if the course SS is 70 and you average 80 for the three rounds then you will be a 10 handicap. If however you averaged 80 but had a triple bogey on each round, you would then be a 9.
One last rule I know about marking the cards is, that the person marking the card must have had a handicap for 6 months. This is so the rules are more likely to be known and implemented.
If you have had a handicap before rules may vary but you will still need 3 scores but your old handicap may be taken into account.
However best thing to do is check the local rules with your own handicap secretary. As far as I know it is not possible to have a handicap without conforming to the above rules.
Outside the UK things vary. For example in Germany you have to exams on the rules of golf and get a diploma from a Pro to say you can play.