The short answer is no, it is not free to get a book published. Generally, traditional publishing requires an agent, who is typicallypaid a percentage of the total money the book makes; and a publishing company, who will charge a fee for their services in producing the book.
If you plan to go the self-publishing route - of which there are now many options - then you will need to pay for the services of a self-publishing company, or if you decide to do it yourself, for the printing costs and for marketing and promotions. The fees involved in self-publishing vary widely, so it's important to do your homework and shop around.
There are also a handful of websites that offer free services to self-publish, such as Amazon’s Kindle Direct Publishing. If you choose to use any of these, you’ll need to invest time in learning the company's specific setup and procedures.
Generally speaking, getting a book published costs money, unless you are willing to put in a great deal of hard work and learn to use many of the services yourself. Whichever route you take, it's important to remember that no matter how you do it, the success of your book will depend largely on the quality of the book itself and how much effort you put into promoting it.
Here are some links that may be of help:
• https://www.thecreativepenn.com/publishing-options-for-your-book/
• https://www.writersandartists.co.uk/publishing/getting-your-book-published
• https://blog.reedsy.com/how-to-publish-a-book/