Unfortunately, most other answers here don't have any sources. I'll answer this from the perspective of German lawmakers and translate the appropriate sources, since that's what I am most familiar with.
Germany made it mandatory for cars to have seats belts on the front seats on 1974-01-01, for rear seats on 1979-05-01. Since 1988-01-01 the outer rear seats need to have three-point belts. Trucks need to have seat belts since 1992, buses since 1999 and since 2004-07-01 all cars need to have three point belts on all seats. You can see from this timeline that adoption of the seat belt took its time. It wasn't without opposition.
But the point is: Why are seat belts mandatory? I will get to that indirectly. Lets first look at the problem they are solving.
Between 1960 and 1970, the number of cars on Germany's roads doubled to 14 million, the number of accident victims grew steadily and reached a peak in 1970 with around 21,300 killed. The development of accident statistics alarmed politicians and the population. The public was no longer willing to accept the victims of road traffic without action.
It wasn't only politicians who saw the problem. At least in Germany, public opinion was that reducing death and injury caused by traffic accidents is a good thing.
Is the seat belt effective?
This question might seem irrelevant to the law at first, but it actually isn't. Laws have to weigh consequences, and a law that puts a burden on someone has to have a merit that outweighs the burden.
American, Swedish and British studies have shown that the general use of seat belts can reduce the number of deaths and the number or severity of injuries by 50 to 60 percent.
So yes, seat belts were presumed to be very effective at doing what they are supposed to do, and everything we have learned since then has reinforced this points. Seat belts are probably one of the most effective security tools in a car.
That being said, the German government did not want to make the wearing of seat belts mandatory at that time:
The intention is to refrain from a legal obligation to wear belts, as this would not eliminate the existing prejudices in the population against the use of belts, but perhaps only increase them.
It took until 1973, when accidents rates were still extremely high, that the German government started considering making them mandatory. And while they were made mandatory in 1976, there was no penalty for not wearing them until 1984.
Can you achieve the wanted effect on a voluntary basis?
Remember, it was public opinion that deaths and injuries from traffic accidents were too high. It stands to reason that such an effective tool as the seat belt would see high adoption rates on a voluntary basis, right? No. Humans are funny that way, we aren't rational beings.
A study conducted in the early 70s found that irrational fears which are in no way rooted in reality drove adoption of the belt way down:
The seat belt was primarily associated with the dangers of an accident and its consequences, and only secondarily with his actual function, namely especially to protect against these dangers. For 60 percent, the motorist connected the belt with the fear to be burnt inside a vehicle, for 75 per cent with the Fears that emergency responders could possibly not remove the seat belt fast enough. 40 percent associated the Belt with the idea of bondage. The idea that the belt could, in an accident, cause particular dangers, was latently presents among the motorists, without having experience with it or being able to draw on the experience of others. This was obviously the explanation why fears about the belt stubbornly persisted, although they have been informed about which protective function the belt actually offers for quite some time.
So despite a public want for more safety, voluntary adoption was abysmal due to completely irrational fears surrounding the seat belt. Its a paradoxical situation that can not be solved by making rational arguments and appealing to the individual.
And now, the final question: Given all of the above, is requiring seat belts legal?
And the answer is yes. Weighing the pros and cons, it turns out to be legal, at least under the German constitution:
In simple terms, it can be condensed to the question: May the State force the individual to do something for his own protection? At the introduction of compulsory seat belts in 1976, the German government had explicitly stated that it was of the firm belief that the use of safety belts significantly reduced the number of fatalities and serious injuries that could be.
The fear that safety belts could have a negative effect in certain accident situations, such as a fire in the vehicle or a fall into the water, was unfounded. The Federal Government was of the opinion that the obligation to wear prescribed seat belts did not constitute a constitutionally unlawful encroachment on the general freedom of action. The existing road traffic regulations already restrict the the freedom of the individual in the public interest. The same applies to construction and equipment regulations. Most of the provisions serve not only to protect third parties, but also to protect road users themselves. The obligation to wear seat belts, although mainly for self-protection, would not be confined to that either. After all, the driver of a motor vehicle, who remained conscious because of the protective effect of the seat belt, was still best able to react correctly and quickly according to the circumstances after an accident and thus avert dangers to others. In principle, this also applies to the passenger. In view of this protective effect on life and limb, but also in view of the avoidable consequential costs of the accident for the general public, the public interest in such an effective safety measure was so great that the relatively minor interference with the general freedom of action was justified. This applied all the more so because restrictions of the general freedom of action were in the nature of all road traffic law. In the present case, they were not more severe than in many existing regulations.
And finally, a point on your idea of "freedom":
What I understand by "freedom" is that "I should be able to do anything and everything, if it DOES NOT AT ALL hurt anything or anyone, be it financially, physically, mentally etc."
But traffic accidents hurt people. They hurt the people who are in them. They hurt the first responders. Not being able to render first aid or to call emergency services endangers people. If the seat belts keeps you alive long enough to call emergency services, then a life might be saved. Not being able to do that puts others in danger. The strain you put on the health care system and on social security systems e.g. due to being unable to continue to work is a burden on the society as a whole. Being ejected from a car makes your body a high-speed projectile with the capability to injure and kill other people. Being thrown around in the car makes your body a deadly projectile that can hurt other occupants of the car. The list of consequences to other people and society as a whole is quite long, actually.