If an e-commerce company called, for example, "ABC Ltd" set up a web
site called "ecommerce.co.uk" does it necessary to register the web
site name as trademark in UK?
It is not REQUIRED to have a trademark in order to set up a web site.
If you intend to conduct legitimate business on the web site, it's
a darned good idea to protect yourself.
For example if "ecommerce.co.uk" does not have trademark in UK can any
scammer register one trademark and use the domain name to make money
legally?
If you don't register a trademark you are using, someone else,
scammer or not, can register it and perhaps make YOU quit using it,
perhaps make you turn the domain name over to them, or make you pay
a bunch of money for the rights to use it.