The Hamiltonian you want is (in the interaction picture, where the $\hbar \omega_1 \hat{n}_1$ stuff is removed) :
$$H = c ( \hat{a}^{\dagger}_1 \hat{a}_2 - \hat{a}_1 \hat{a}^\dagger_2) $$
where $c$ is some coupling strength between the modes.
The clearest way of understanding this Hamiltonian is to look at a directional coupler:
Directional couplers are beam splitters built in a more transparent way. The two waveguides are brought close, enabling a photon initially in one of the two waveguides to move into the other one. The beam splitter Hamiltonian only applies while the photons are in the beam splitter, so how long it lasts is determined by the length of the close-section. The higher the coupling strength, and the longer the waveguides are together the more likely the photon is to hop from one side to the other. (There is a length/coupling where this chance is 100%, beyond this length it can hop back and forth multiple times, resulting in effectively less than 100% crossing chance).
The splitting ratio (related to your $\theta$) is determined by the coupling constant ($c$) and the length of the beam splitter so that the overall effect of the beam splitter Hamiltonian, applied for the length of time it takes for a photon to pass through, is the unitary you wrote in the question. Mathematically
$$U = \exp\left( \frac{i}{\hbar} \int H dt \right) $$
where the length of the time integral is the time taken for a photon to pass through the beam splitter.
(Note that for bulk optical beam splitters the "length" is not the size of the glass block, it is the length of the half-silvered mirror or whatever it is that is inside the glass block).
arXiv:quant-ph/0305007 has more details.