He is the royal advisor
The emperor's astrological needs were Kepler's top priority as the royal mathematician. Despite having a negative opinion of modern astrologers' attempts to correctly forecast the future or specific divine happenings, Kepler prepared thorough horoscopes that he had received from many people during his time as a student in Tübingen. In addition to giving horoscopes to allies and foreign rulers, the emperor consulted Kepler for counsel while facing challenging political situations. In addition to actively following Kepler's astrophysics work, Rudolf was also interested in the work of many other scholars in his court, including many alchemists.
Although only Catholicism and the Reformation were officially recognized as valid religious beliefs in Prague, Kepler's position at the court allowed him to freely practice his Lutheran faith. Although the emperor supposedly offered a comfortable lifestyle for his family, the problem here is that he doesn't have enough money to pay his debts. The financial situation is never easy. His home life with Barbara was not a happy one, full of fights and illness, partly because of financial issues. However, Kepler's court life introduced him to astronomical study and other distinguished scholars (such as Johannes Matthäus Wackher von Wackhenfels, Jost Bürgi, David Fabricius, Martin Bachazek, and Johannes Brengger). Learning advances quickly.