First, you will need to install Flatpak itself - to do that, go to https://flatpak.org/ and install the software choosing your distribution and following the instruction.
For example, to install Flatpak on Ubuntu 18.10 (Cosmic Cuttlefish) or Ubuntu 19.04 (Disco Dingo), simply run:
$ sudo apt install flatpak
With older Ubuntu versions, the official Flatpak PPA is the recommended way to install Flatpak. To install it, run the following in the terminal:
$ sudo add-apt-repository ppa:alexlarsson/flatpak
$ sudo apt update
$ sudo apt install flatpak