As Mohan points out in the comments, there is a canonical $K$-vector space isomorphism $\Omega^1_{X/k,\eta}\simeq\Omega_{K/k}^1$, where $\eta$ is the generic point of $X$.
(It seems like you're assuming $X$ is regular, or equivalently smooth over $k$, since otherwise $\Omega_{X/k}^1$ need not be locally free.) What you're talking about with divisors associated to "rational differentials" is a particular case of a somewhat more general construction. Let $X$ be any integral scheme with generic point $\eta$ and function field $K$. If $\mathscr{L}$ is an invertible $\mathscr{O}_X$-module, then (non-zero) elements of the $1$-dimensional $K$-vector space $\mathscr{L}_\eta$ are often called rational sections of $\mathscr{L}$ (maybe $0$ deserves to be a rational section too, but let's focus on non-zero rational sections). By the definition of $\mathscr{L}_\eta$ as the colimit over $\mathscr{L}(U)$ for $U$ non-empty and open in $X$, such rational sections can also be described as equivalence classes of pairs $(U,s)$, where $U$ is a non-empty open of $X$ and $s$ a section in $\mathscr{L}(U)$, and the equivalence relation is equality on intersections (a priori the equivalence relation looks weaker than this, but the restriction maps of $\mathscr{L}$ are injective due to integrality of $X$ and $\mathscr{L}$ being finite locally free, so the apparently stronger relation of equality on intersections holds). Now assume, in addition, that $X$ is Noetherian and regular at all codimension-$1$ points, that is, the stalks of $\mathscr{O}_X$ at points of codimension $1$ are discrete valuation rings. Then we can associate to any non-zero rational section $s$ as above a Weil divisor $\mathrm{div}^\mathscr{L}(s)$ by looking at the image of $s$ under trivializations of $\mathscr{L}$ in neighborhoods of each codimension -$1$ point and taking valuations of these images. So one can write $\mathrm{div}^\mathscr{L}(s)=\sum_x\mathrm{ord}_x(s)\cdot Z_x$, where the sum is over the points of codimension $1$ and $Z_x=\overline{\{x\}}$ is the corresponding integral closed subscheme of codimension $1$ (i.e. prime Weil divisor). (The Noetherianity ensures that $\mathrm{ord}_x(s)=0$ for all but finitely many $x$ in the sum.)
Suppose now that $s$ and $t$ are non-zero rational sections of $\mathscr{L}$. Then because $\mathscr{L}_\eta$ is $1$-dimensional over $K$, there is a non-zero element of $K$, i.e. a rational function $f$ on $X$ (which is incidentally by our definition a rational section of the trivial sheaf $\mathscr{O}_X$) for which $s=ft$ (the equality taking place in $\mathscr{L}_\eta$). One can verify from the definition that for each codimension-$1$ point $x$, $\mathrm{ord}_x(s)=\mathrm{ord}_x(ft)=\mathrm{ord}_x(f)+\mathrm{ord}_x(t)$. This means that for the associated Weil divisors we have $\mathrm{div}^\mathscr{L}(s)=\mathrm{div}(f)+\mathrm{div}^\mathscr{L}(t)$, where $\mathrm{div}(f)$ is the usual principal divisor associated to a non-zero element of $K$, and coincides with $\mathrm{div}^{\mathscr{O}_X}(f)$ as we have defined it. At any rate, we find that any two non-zero rational sections of $\mathscr{L}$ give rise to linearly equivalent Weil divisors. Thus to every invertible $\mathscr{O}_X$-module we have a well-defined associated Weil divisor class.
This can be applied in particular to a smooth projective curve $X$ over $k$ and the invertible $\mathscr{O}_X$-module $\Omega_{X/k}^1$, recovering the equality you ask about, and giving a well-defined canonical divisor class. Note the rational differentials have to be non-zero. This makes sense because for such an $X$, one can define an invertible $\mathscr{O}_X$-module $\mathscr{O}_X(\mathrm{div}^{\Omega_{X/k}^1}(\omega))$ for any non-zero rational differential $\omega$, and this will be isomorphic to the invertible sheaf from which $\omega$ came, namely $\Omega_{X/k}^1$, the canonical sheaf of $X$.