For now, it is still not known, how the company plans to enter the Formula One, however, they were already cooperating with Red Bull in the world rally championships. What is known for now is that Audi is ready to offer around 500 million euros (556 million dollars) for British McLaren as means to enter the competition. Porsche on the other hand is aiming to create a long-term partnership with other racing team Red Bull. The deal is expected to be done in the following years.
The decision to join Formula One might have something to do with other speculations – that Porsche is planning to enter the stock market and make a possible listing of Porsche AG. Listing, if agreed, will happen in the last quarter of this year. Joining Formula One will probably take few years, before it happens.

Movement of Volkswagen’s stocks in last five years. (Source: Trading Economics)
Sources:
https://tradingeconomics.com/vow3:gr
https://financialpost.com/pmn/business-pmn/audi-porsche-have-decided-to-join-formula-one-vw-ceo-says