Yes - it was a real thing. Lemons were cheaper and more readily available than condoms. Better than nothing.
If I recall the idea came when a researcher in a Western country, maybe UK, gave a community talk about contraception and at the end two lovely old ladies came up to him and said, giggling, that if a girl inserts a lemon after sex she won’t get pregnant.