Preheat the oven to 400 degrees F (200 degrees C). Spray a sheet pan with cooking spray.
Slice eggplant into 1-inch thick slices, then quarter the slices. Chop onion in half, then quarter the halves.
Place eggplant and onion on the prepared sheet pan. Drizzle with olive oil, then sprinkle with garlic, salt, and pepper. Toss with your hands until well coated.
Bake in the preheated oven until golden brown and tender, about 40 minutes, tossing halfway through.