No, contrary to, e.g., the USA, a mark doesn't have to be used in commerce before applying for an EU trademark. EU is a first-to-file jurisdiction, where priority rights are granted to the entity first filing the application. This approach gives brand owners the option to start securing their rights before launching a product or service.
However, trademark law in any country and system should be used in good faith, meaning to seek protection for a future business venture rather than prevent others from obtaining the trademark. For this reason, if a registered EU trademark has not been used in commerce for five years after registration, third parties can challenge the registration, which can result in cancellation.