Can onion be eaten raw? I am not sure if it first has to be cooked.
Onion can be eaten raw, and there are many cultures that have food preparations making use of raw onion. There are, of course, many varieties of onion, and many types alliums (leeks, chives...etc.), each with their own flavor profiles. You certainly might like some raw more than others, and these different alliums are often used (cooked or raw) according to their individual flavor profiles and applications.
When my father was a boy he was evacuated to a small farming village in the north west of the Netherlands, and in that village the boys would eat onions as my father would eat an apple. Raw, just take the dried skins off and bite into it.
It takes a getting used to it, as the onion flavour is quite strong and onions also have a sharp taste.
But it is not harmful, unless your are allergic.
Of course, in preparing food we use raw onions in several ways, the most basic I used was cut very thin and eaten with just a bit of lemon juice (youth hostel meal where we made use of whatever was there and there was not much.) It is way more common to find raw onion in mixed salads, sliced quite thinly, also to tone down the taste.