The main openSUSE repository does not feature the latest version of VirtualBox. To obtain the latest version of the software, one may use VirtualBox's own repo for openSUSE. Details are available on the virtualbox.org project website. However, I am reproducing them here for a quick reference & also to address some quirks that you might encounter if you simply add the repo & install VirtualBox.

Step 1

We add the VirtualBox repository by creating the /etc/zypp/repos.d/virtualbox.repo file with the below content.

[virtualbox]
name=VirtualBox for openSUSE 15.0 - $basearch
enabled=1
autorefresh=1
baseurl=http://download.virtualbox.org/virtualbox/rpm/opensuse/15.0/$basearch
priority=120
gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
keeppackages=0

VirtualBox does not have a separate repository for Leap 15.1, 15.2, etc. The repo for Leap 15.0 should work just fine.

Step 2

Refresh the repositories and search for the latest version of VirtualBox.

sudo zypper ref && zypper se virtualbox

The output of the command is shown below.

S | Name                           | Summary                                          | Type
--+--------------------------------+--------------------------------------------------+-----------
  | VirtualBox-5.2                 | Oracle VM VirtualBox                             | package
  | VirtualBox-6.0                 | Oracle VM VirtualBox                             | package
  | VirtualBox-6.1                 | Oracle VM VirtualBox                             | package
  | python3-virtualbox             | Python bindings for virtualbox                   | package
  | virtualbox                     | VirtualBox is an Emulator                        | package
  | virtualbox                     | VirtualBox is an Emulator                        | srcpackage
  | virtualbox-devel               | Devel files for virtualbox                       | package
  | virtualbox-guest-desktop-icons | Icons for guest desktop files                    | package
  | virtualbox-guest-source        | Source files for virtualbox guest kernel modules | package
  | virtualbox-guest-tools         | VirtualBox guest tools                           | package
  | virtualbox-guest-x11           | VirtualBox X11 drivers for mouse and video       | package
  | virtualbox-host-source         | Source files for virtualbox host kernel modules  | package
  | virtualbox-kmp                 | Kernel modules for VirtualBox                    | srcpackage
  | virtualbox-kmp-default         | Kernel modules for VirtualBox                    | package
  | virtualbox-kmp-preempt         | Kernel modules for VirtualBox                    | package
  | virtualbox-qt                  | Qt GUI part for virtualbox                       | package
  | virtualbox-vnc                 | VNC desktop sharing                              | package
  | virtualbox-websrv              | WebService GUI part for virtualbox               | package

Step 3

We pick the latest version, in this case VirtualBox 6.1, and install it as follows:

sudo zypper in gcc kernel-default-devel VirtualBox-6.1

Notice that we installed the GCC compiler and the Kernel development files which will be required by VirtualBox to compile and install driver modules into the system kernel. Unless these driver modules are installed we won't be able to create virtual machines or we might create the virtual machines but not be able to start them.

VirtualBox 6.1 running on openSUSE Leap 15.2
VirtualBox 6.1 running on openSUSE Leap 15.2

Once all commands have completed successfully, we can run VirtualBox 6.1.

If you would like to expertiment on openSUSE using VirtualBox, you should know that you can grab the openSUSE Leap 15.2, Tumbleweed and MicroOS images for VirtualBox.