How, if at all, does karma exist in the form and formless realms? How, if at all, does karma exist in the form and formless realms?
Obviously, as humans in the desire realm, we can suffer misfortune, etc., due to our karma. But what about events in these other realms, either when in absorption or reborn there?
Is being reborn there just one constant bliss?
Taking a Theravada view, the immaterial realms - what you call formless - occur when a practitioner dies whilst dwelling in one of the four arupa ayatanas:

The dimension of the perception of space
The dimensions of the perception boundless consciousness
The dimensions of the perception of nothingness
The dimension of neither perception nor non-perception

Because these states still contain figments of conditionality, after death the mind (citta) gravitates to those figments thus perpetuating the continuation of that respective consciousness. As I currently understand, the dimension of neither perception nor non-perception is considered to be at the very prelude to the finality of reality in the grand scheme of dhamma: the figments of consciousness that exist there are too tenuous to cause any major form-based re-becoming disturbances. The task here is traversing the pleasure of being relinquished from those form-based consciousnesses.
I have a long held a contention about the commonly held view in Theravada concerning rupa jhana and arupa ayatanas. The contention concerns the progressive models from jhana to ayatana that are often touted. In my view they are very distinct and either set doesn't necessarily inform the other set.
Back to the question: what we could say is that the practitioner, working in the sensuous domain, having previously developed his mind in accordance with dhamma, and having passed away, now finds himself dwelling in some heightened pleasurable state; one of the four arupa ayatanas. This could be said to have happened because the cause of that final state was due to the practice: due to this karma the practitioner traversed from the form state to the formless.