The phrase "out of necessity" means doing something because it is essential, required, or unavoidable. It often implies that the action is taken due to circumstances, not because of preference or desire.
In your examples, "out of necessity" can align with both need and requirements, depending on the context:
I drive a car out of necessity, but I much prefer riding my bicycle.
This means you drive a car because it is necessary or required for practical reasons (e.g., work, errands).
Many people in the world are forced to steal out of necessity, lest they starve to death.
Here, it clearly means need—people steal because their survival depends on it.
We sold our car out of necessity.
This suggests the sale was required due to financial or situational need, even if it wasn’t desirable.
In short, "out of necessity" reflects a response to needs or requirements brought about by circumstances. Whether it's literal (e.g., stealing to avoid starvation) or situational (e.g., selling a car to meet financial needs), it always conveys a sense of compulsion.