Start by heating the olive oil in a large skillet over medium heat. Add the diced onion and sauté for about 3-4 minutes until it becomes translucent. Then, stir in the minced garlic and cook for an additional minute, until fragrant.
Now, toss in the chopped spinach, stirring until it wilts, which should take about 2 minutes. Next, add the shredded chicken, marinara sauce, Italian seasoning, salt, and black pepper. Mix everything together until well combined, then remove from heat.
If you are using fresh ravioli, cook them according to the package instructions until they float to the surface, usually about 2-3 minutes. If using frozen ravioli, cook them until they are tender but not overcooked. Drain and set aside.
Preheat your oven to 375°F (190°C). In a baking dish, spread a thin layer of the chicken and spinach mixture on the bottom. Layer half of the cooked ravioli on top, then add more of the chicken and spinach mixture. Repeat the layers, finishing with the remaining chicken and spinach mixture.
Sprinkle the shredded mozzarella and grated Parmesan cheese evenly over the top of the dish.
Cover the baking dish with aluminum foil and bake in the preheated oven for 20 minutes. After that, remove the foil and bake for an additional 10-15 minutes, or until the cheese is melted and bubbly.