Cook oil and garlic in a small saucepan over low heat until garlic is soft but not yet golden, about 10 minutes. Remove pan from heat and let cool. Strain garlic oil through a fine-mesh sieve into a small bowl; set aside.
Place shrimp and onion in separate medium bowls; season with salt and pepper. Heat a cast-iron griddle over high heat until smoking. You can also cook on a barbecue grill. Arrange shrimp on one half of griddle in a single layer and onion on the other half.
Alternatively, using a cast-iron skillet, cook shrimp first, then onion (don’t overcrowd the pan or the shrimp will steam instead of sear). Cook until shrimp are golden brown, about 1 minute.
Turn shrimp and onion, drizzle with some garlic oil, and cook until shrimp are cooked through, about 1 minute longer. Divide shrimp and onion among plates; garnish with parsley. Squeeze lemon over top.