It's obviously Ok to ask them.
Let's say you made $X per year. The training cost $Y. After the training your value for the company increased (by more than $Y obviously). The company quite obviously doesn't want to pay for the training and then not get the benefits.
If the new company benefits from the training, they have the choice of hiring you, or hiring someone without the training and paying $Y for training. In that case you would expect either a higher salary than the other guy, or for the new company to pay some of the cost. So it's reasonable that you ask, and reasonable to expect either help for the repayment or a higher salary.
If the new company doesn't benefit from the training, it should be obvious to them that you don't like leaving your old company if it means you have to pay back this money. They either want you so much that they help with your decision, or they don't. It's still reasonable to ask. It's reasonable for them to decide what they offer you. They might offer you nothing, half the money, all of it, depending on their situation and how much they want you.